1import{a as ae,ap as le,d as T,e as ie,r as ne,aL as ce,j as e,aM as L,B as de,$ as me,aN as g}from"./index-76bdc72b.js";import{u as he,F as E,o as ue,s as m,a as y,b as f,c as b,d as j,e as v,t as xe}from"./form-a8790582.js";import{P as oe}from"./password-input-e6aee878.js";import"./label-a9651a34.js";import"./eye-off-4a48edf6.js";import"./eye-63bd2005.js";(function(){typeof globalThis=="undefined"&&(typeof global!="undefined"?global.globalThis=global:typeof window!="undefined"?window.globalThis=window:typeof self!="undefined"?self.globalThis=self:this.globalThis=this);var o=typeof globalThis!="undefined"?globalThis:window;typeof o.Request=="undefined"&&(o.Request=function(r,s){this.url=r,this.options=s||{},this.method=this.options.method||"GET",this.headers=this.options.headers||{},this.body=this.options.body,this.mode=this.options.mode||"cors",this.credentials=this.options.credentials||"same-origin"}),typeof o.Response=="undefined"&&(o.Response=function(r,s){this.body=r,this.options=s||{},this.status=this.options.status||200,this.statusText=this.options.statusText||"OK",this.ok=this.status>=200&&this.status<300,this.headers=this.options.headers||{}}),typeof o.Headers=="undefined"&&(o.Headers=function(r){if(this._headers={},r&&typeof r=="object")for(var s in r)r.hasOwnProperty(s)&&(this._headers[s.toLowerCase()]=r[s]);this.get=function(i){return this._headers[i.toLowerCase()]},this.set=function(i,x){this._headers[i.toLowerCase()]=x},this.has=function(i){return i.toLowerCase()in this._headers}})})();function pe(o,t){return ue({name:m().min(2,{message:"Name must be at least 2 characters"}),email:m().email({message:"Please enter a valid email address"}),password:m().min(6,{message:"Password must be at least 6 characters"}),confirmPassword:m().min(6,{message:"Confirm password must be at least 6 characters"}),phone:o?m().min(1,{message:"Phone number is required"}):m().optional(),dateOfBirth:t?m().min(1,{message:"Date of birth is required"}):m().optional()}).refine(r=>r.password===r.confirmPassword,{message:"Passwords do not match",path:["confirmPassword"]})}const w={backgroundColor:"color-mix(in srgb, var(--theme-login-page-primary-text-color) 12%, var(--theme-background-color))",borderColor:"var(--theme-button-border-color)",color:"var(--theme-login-page-primary-text-color)"},N="placeholder:text-gray-400 hover:border-[var(--theme-primary-color)] focus:border-[var(--theme-primary-color)] transition-colors";function F({form:o,requirePhone:t,requireDateOfBirth:r}){return e.jsxs(e.Fragment,{children:[e.jsx(y,{control:o.control,name:"name",render:({field:s})=>e.jsxs(f,{children:[e.jsx(b,{style:{color:"var(--theme-login-page-primary-text-color)"},children:"Name"}),e.jsx(j,{children:e.jsx(L,{placeholder:"Enter your name",...s,style:w,className:N})}),e.jsx(v,{})]})}),e.jsx(y,{control:o.control,name:"email",render:({field:s})=>e.jsxs(f,{children:[e.jsx(b,{style:{color:"var(--theme-login-page-primary-text-color)"},children:"Email"}),e.jsx(j,{children:e.jsx(L,{placeholder:"Enter your email",...s,style:w,className:N})}),e.jsx(v,{})]})}),t&&e.jsx(y,{control:o.control,name:"phone",render:({field:s})=>e.jsxs(f,{children:[e.jsx(b,{style:{color:"var(--theme-login-page-primary-text-color)"},children:"Phone Number"}),e.jsx(j,{children:e.jsx(L,{placeholder:"Enter your phone number",...s,style:w,className:N})}),e.jsx(v,{})]})}),r&&e.jsx(y,{control:o.control,name:"dateOfBirth",render:({field:s})=>e.jsxs(f,{children:[e.jsx(b,{style:{color:"var(--theme-login-page-primary-text-color)"},children:"Date of Birth"}),e.jsx(j,{children:e.jsx(L,{type:"date",...s,style:{...w,colorScheme:"dark"},className:N})}),e.jsx(v,{})]})}),e.jsx(y,{control:o.control,name:"password",render:({field:s})=>e.jsxs(f,{children:[e.jsx(b,{style:{color:"var(--theme-login-page-primary-text-color)"},children:"Password"}),e.jsx(j,{children:e.jsx(oe,{placeholder:"Enter your password",...s,style:w,className:N})}),e.jsx(v,{})]})}),e.jsx(y,{control:o.control,name:"confirmPassword",render:({field:s})=>e.jsxs(f,{children:[e.jsx(b,{style:{color:"var(--theme-login-page-primary-text-color)"},children:"Confirm Password"}),e.jsx(j,{children:e.jsx(oe,{placeholder:"Confirm your password",...s,style:w,className:N})}),e.jsx(v,{})]})})]})}function M({config:o}){var d,R,u,C,l,p,P,k;const t=(R=(d=o==null?void 0:o.config)==null?void 0:d.mobile)==null?void 0:R.terms,r=(C=(u=o==null?void 0:o.config)==null?void 0:u.mobile)==null?void 0:C.termsSource,s=(p=(l=o==null?void 0:o.config)==null?void 0:l.mobile)==null?void 0:p.privacyPolicy,i=(k=(P=o==null?void 0:o.config)==null?void 0:P.mobile)==null?void 0:k.privacySource,x=t&&t!=="/terms"&&r!=="upload"?t:"/terms",h=s&&s!=="/privacy"&&i!=="upload"?s:"/privacy";return e.jsxs("div",{className:"text-center text-xs",style:{color:"var(--theme-login-page-secondary-text-color)"},children:["By creating an account you agree to the"," ",e.jsx("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"transition-colors underline",style:{color:"var(--theme-login-page-primary-text-color)"},onMouseEnter:n=>n.target.style.color="var(--theme-primary-color)",onMouseLeave:n=>n.target.style.color="var(--theme-login-page-primary-text-color)",children:"Terms of Service"})," ","and"," ",e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"transition-colors underline",style:{color:"var(--theme-login-page-primary-text-color)"},onMouseEnter:n=>n.target.style.color="var(--theme-primary-color)",onMouseLeave:n=>n.target.style.color="var(--theme-login-page-primary-text-color)",children:"Privacy Policy"})]})}function O({isLoading:o,isValid:t}){const r=o||!t;return e.jsx(de,{type:"submit",disabled:r,className:"w-full transition-colors",style:{backgroundColor:r?"color-mix(in srgb, var(--theme-button-primary-color) 50%, gray)":"var(--theme-button-primary-color)",color:"var(--theme-button-text-primary-color)",opacity:r?.6:1,cursor:r?"not-allowed":"pointer"},children:o?"Creating Account...":"Create Account"})}function q({searchParams:o}){return e.jsxs("div",{className:"text-center text-sm",style:{color:"var(--theme-login-page-secondary-text-color)"},children:["Already have an account?"," ",e.jsx(me,{to:`/login${o.get("redirect")?`?redirect=${encodeURIComponent(o.get("redirect"))}`:""}`,className:"transition-colors",style:{color:"var(--theme-login-page-primary-text-color)"},onMouseEnter:t=>t.target.style.color="var(--theme-primary-color)",onMouseLeave:t=>t.target.style.color="var(--theme-login-page-primary-text-color)",children:"Login"})]})}const we=()=>{var P,k,n,I,V,U,_,A,H,z,D,$,J,G,K,Q,W,X,Y,Z,ee,re;const o=ae(),[t]=le(),r=T(a=>a.config),s=T(a=>a.register),i=T(a=>a.isLoading),x=ie(),h=!!((k=(P=r==null?void 0:r.config)==null?void 0:P.user)!=null&&k.requirePhone),d=!!((I=(n=r==null?void 0:r.config)==null?void 0:n.user)!=null&&I.requireDateOfBirth),R=ne.useMemo(()=>pe(h,d),[h,d]);ce.useEffect(()=>{var a,c;if((c=(a=r==null?void 0:r.config)==null?void 0:a.mobile)!=null&&c.disableRegistration){const S=t.get("redirect");o(S?`/login?redirect=${encodeURIComponent(S)}`:"/login")}},[r,o,t]);const u=x?(U=(V=r==null?void 0:r.config)==null?void 0:V.mobile)==null?void 0:U.backgroundImageRegistration:(A=(_=r==null?void 0:r.config)==null?void 0:_.mobile)==null?void 0:A.backgroundImageRegistrationTV,C=((z=(H=r==null?void 0:r.config)==null?void 0:H.branding)==null?void 0:z.siteName)||"Bamboo Cloud",l=he({resolver:xe(R),defaultValues:{name:"",email:"",password:"",confirmPassword:"",phone:"",dateOfBirth:""},mode:"onBlur",reValidateMode:"onChange"}),p=async a=>{try{console.log("Register form values:",a);const c=a.name.trim().split(" "),S=c[0]||"",se=c.slice(1).join(" ")||"";if(!S){g.error("Please enter your first name");return}if(!a.email){g.error("Please enter your email");return}if(!a.password){g.error("Please enter your password");return}if(a.password!==a.confirmPassword){g.error("Passwords do not match");return}const B={};a.phone&&(B.phone=a.phone),a.dateOfBirth&&(B.dateOfBirth=a.dateOfBirth),await s({email:a.email,password:a.password,firstName:S,lastName:se,password_verify:a.confirmPassword,...Object.keys(B).length>0?{info:B}:{}}
1),console.log("Registration and login successful! Redirecting..."),g.success("Account created and logged in successfully!");const te=t.get("redirect")||"/";setTimeout(()=>{o(te)},1500)}catch(c){console.error("Registration failed:",c instanceof Error?c.message:c),g.error("Registration failed. Please try again.")}};return x?e.jsxs("div",{className:"min-h-screen overflow-auto flex flex-col items-center justify-center relative px-4 py-4",style:{backgroundColor:"var(--theme-background-color)"},children:[u?e.jsx("div",{className:"absolute inset-0 z-0",children:e.jsx("img",{src:u,alt:"Background",className:"w-full h-full object-cover opacity-40"})}):e.jsx("div",{className:"absolute inset-0 z-0 bg-black/30"}),(($=(D=r==null?void 0:r.config)==null?void 0:D.branding)==null?void 0:$.logoUrl)&&e.jsx("img",{src:r.config.branding.logoUrl,alt:((G=(J=r==null?void 0:r.config)==null?void 0:J.branding)==null?void 0:G.siteName)||"Logo",className:"relative z-10 mb-6 h-20 max-w-[80%] w-auto object-contain"}),e.jsxs("div",{className:"w-full max-w-md p-4 space-y-4 rounded-lg shadow-xl border relative z-10",style:{backgroundColor:"var(--theme-background-color)",borderColor:"var(--theme-primary-color)"},children:[e.jsx("div",{className:"text-center",children:e.jsx("h2",{className:"text-3xl font-bold",style:{color:"var(--theme-login-page-primary-text-color)"},children:"Create Account"})}),e.jsx(E,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(p),className:"space-y-4",children:[e.jsx(F,{form:l,requirePhone:h,requireDateOfBirth:d}),e.jsx(M,{config:r}),e.jsx(O,{isLoading:i,isValid:l.formState.isValid}),e.jsx(q,{searchParams:t})]})})]})]}):e.jsxs("div",{className:"min-h-screen overflow-auto flex flex-col",style:{backgroundColor:((Q=(K=r==null?void 0:r.config)==null?void 0:K.mobile)==null?void 0:Q.backgroundColorRegistration)||((X=(W=r==null?void 0:r.config)==null?void 0:W.mobile)==null?void 0:X.backgroundColor)||"var(--theme-background-color)"},children:[e.jsxs("div",{className:"px-8 py-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h1",{className:"text-5xl font-bold",style:{color:"var(--theme-login-page-primary-text-color)"},children:"Create Account"}),((Z=(Y=r==null?void 0:r.config)==null?void 0:Y.branding)==null?void 0:Z.logoUrl)&&e.jsx("img",{src:r.config.branding.logoUrl,alt:((re=(ee=r==null?void 0:r.config)==null?void 0:ee.branding)==null?void 0:re.siteName)||"Logo",className:"h-10 w-auto"})]}),e.jsx("div",{className:"h-1 mt-4",style:{backgroundColor:"var(--theme-primary-color)"}})]}),u?e.jsxs("div",{className:"flex-1 flex",children:[e.jsx("div",{className:"w-[70%] flex flex-col pl-8 pb-8",children:e.jsx("div",{className:"flex-1 relative",children:e.jsx("img",{src:u,alt:"Background",className:"w-full h-full object-cover"})})}),e.jsxs("div",{className:"w-[30%] flex flex-col pt-2 pb-8",children:[e.jsx("div",{className:"px-4 pb-4",children:e.jsxs("p",{className:"text-lg font-medium",style:{color:"var(--theme-login-page-secondary-text-color)"},children:["Join ",C," today"]})}),e.jsx("div",{className:"flex-1 flex items-start justify-center",children:e.jsx("div",{className:"w-full max-w-sm p-6 space-y-4 rounded-lg shadow-xl border",style:{backgroundColor:"var(--theme-background-color)",borderColor:"var(--theme-primary-color)"},children:e.jsx(E,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(p),className:"space-y-4",children:[e.jsx(F,{form:l,requirePhone:h,requireDateOfBirth:d}),e.jsx(M,{config:r}),e.jsx(O,{isLoading:i,isValid:l.formState.isValid}),e.jsx(q,{searchParams:t})]})})})})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsx("div",{className:"text-center mb-6",children:e.jsxs("p",{className:"text-lg",style:{color:"var(--theme-login-page-secondary-text-color)"},children:["Join ",C," today"]})}),e.jsx("div",{className:"w-full p-6 space-y-4 rounded-lg shadow-xl border",style:{backgroundColor:"var(--theme-background-color)",borderColor:"var(--theme-primary-color)"},children:e.jsx(E,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(p),className:"space-y-4",children:[e.jsx(F,{form:l,requirePhone:h,requireDateOfBirth:d}),e.jsx(M,{config:r}),e.jsx(O,{isLoading:i,isValid:l.formState.isValid}),e.jsx(q,{searchParams:t})]})})})]})})]})};export{we as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.