1import{j as e,A as R}from"./vendor-motion-C9uFufCg.js";import{r as i}from"./vendor-charts-BlP1Pdbv.js";import{M as $}from"./milo-logo-VIUzRCaq.js";import{F as D}from"./index-BwPQ_dL1.js";import{a as V,L as H,g as N,b as J,c as F,s as W,d as Y,v as Z}from"./index-l8sTCxZG.js";import{g as K}from"./vendor-firebase-DnNwiSSY.js";import{P as Q}from"./PasswordChecklist-zkHe8KWd.js";import{t as P}from"./postOnboarding-DY5nO3HR.js";import{E as A,a as S}from"./eye-zSVoKwjb.js";import"./vendor-select-DbJAgDSj.js";import"./check-nZeBL_GS.js";function E(){return typeof window<"u"&&window.tolt_data||null}function b(){const r=E();if(r&&r.partner_id)return r.partner_id;if(typeof document<"u"){const n=document.cookie.match(/(?:^|;\s*)tolt_referral=([^;]+)/);if(n)return decodeURIComponent(n[1])}return null}function k(r){return b()?"affiliate":r}async function _(r){try{const n=E();n&&!n.customer_id&&window.tolt&&typeof window.tolt.signup=="function"&&await window.tolt.signup(r)}catch(n){console.debug("Tolt signup tracking skipped:",(n==null?void 0:n.message)||n)}}const C="https://api.startmilo.com";function de(){const[r,n]=i.useState(""),[l,T]=i.useState(""),[d,B]=i.useState(""),[v,c]=i.useState(""),[u,p]=i.useState(!1),[g,I]=i.useState(!1),[x,O]=i.useState(!1),[m,y]=i.useState(""),h=V(),q=K();i.useEffect(()=>{y(d?l===d?"":"Passwords do not match":"")},[l,d]);const z=t=>{const o=/[A-Z]/.test(t),a=/[0-9]/.test(t),s=/[!@#$%^&*(),.?":{}|<>_]/.test(t),f=t.length>=6;return!o||!a||!s||!f?"Please meet all password requirements":null},L=t=>t?t.includes("auth/invalid-email")?"Please enter a valid email address":t.includes("auth/email-already-in-use")?"An account with this email already exists":t.includes("auth/weak-password")?"Password should be at least 6 characters":t.includes("auth/operation-not-allowed")?"Account creation is currently disabled":t.includes("auth/too-many-requests")?"Too many login attempts. Try again later":t.includes("auth/network-request-failed")?"Network error. Please try again.":t.includes("auth/internal-error")?"An error occurred. Please try again.":t.includes("auth/popup-closed-by-user")?"You have been logged out. Please log in again.":t:"",M=r&&l&&d,j=async t=>{const o=await q.currentUser.getIdToken();try{const s=await(await fetch(`${C}/api/accounts/users/${t}`,{method:"GET",headers:Z({"Content-Type":"application/json",Authorization:`Bearer ${o}`})})).json();return{isOnboardingFinished:s.is_onboarding_finished,hasPendingInvitations:s.has_pending_team_invitation||s.pending_invitations&&s.pending_invitations.length>0}}catch(a){return console.error("Error checking onboarding:",a),{isOnboardingFinished:!1,hasPendingInvitations:!1}}},G=async t=>{t.preventDefault(),c("");const o=z(l);if(o){c(o);return}if(m){c(m);return}p(!0);try{const a=await fetch(`${C}/api/accounts/users/signup_with_email/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:l,acquisition_source:k(N()),tolt_referral:b(),visitor_id:J()})}),s=await a.json();a.ok?(await _(r),F(),h("/verify")):c(s.error||"Failed to sign up")}catch(a){console.error("Error during signup:",a),c("Network error. Please try again.")}finally{p(!1)}},U=async()=>{c(""),p(!0);const t=await W();if(t.success)try{const{isOnboardingFinished:o,hasPendingInvitations:a}=await j(t.user.uid);if(o)h(P()||"/home");else{const s=k(N()),f=b();if(await _(t.user.email),s||f){const w={};s&&(w.acquisition_source=s),f&&(w.tolt_referral=f),Y(w).catch(()=>{}),s&&F()}h(a?"/invited":"/onboarding")}}catch(o){console.error("Error during Google sign-in flow:",o);const{isOnboardingFinished:a,hasPendingInvitations:s}=await j(t.user.uid);h(a?P()||"/home":s?"/invited":"/onboarding")}else c(t.error);p(!1)};return e.jsx("div",{className:"min-h-[100dvh] w-full flex items-center justify-center p-4 font-poppins",children:e.jsxs("div",{className:"w-full max-w-[420px] space-y-6",children:[e.jsx("div",{className:"flex justify-center mb-8",children:e.jsx(H,{to:"/",children:e.jsx("img",{src:$,alt:"Logo",className:"h-12 w-auto"})})}),e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("h1",{className:"text-3xl font-semibold text-gray-900 font-trap",children:"Create your Milo Account"}),e.jsx("p",{className:"text-gray-500 text-sm px-4",children:"Get started so you can simplify your tasks, stay organized, and get things done - your way."})]}),e.jsxs("form",{onSubmit:G,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{type:"email",placeholder:"Email",value:r,onChange:t=>n(t.target.value),disabled:u,className:"w-full px-4 py-3 rounded-xl border bg-[#F2F3F5] border-[#F2F3F5] focus:border-[#59A6B6] focus:ring-1 focus:ring-[#59A6B6] outline-none transition-colors"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:g?"text":"password",placeholder:"Password",value:l,onCh
1ange:t=>T(t.target.value),disabled:u,className:"w-full px-4 py-3 rounded-xl border bg-[#F2F3F5] border-[#F2F3F5] focus:border-[#59A6B6] focus:ring-1 focus:ring-[#59A6B6] outline-none transition-colors"}),e.jsx("button",{type:"button",onClick:()=>I(!g),className:"absolute right-3 top-6 -translate-y-1/2 text-gray-500 hover:text-gray-700 hover:cursor-pointer",children:g?e.jsx(A,{size:20}):e.jsx(S,{size:20})}),e.jsx(R,{children:l&&e.jsx(Q,{password:l})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:x?"text":"password",placeholder:"Confirm Password",value:d,onChange:t=>B(t.target.value),disabled:u,className:"w-full px-4 py-3 rounded-xl border bg-[#F2F3F5] border-[#F2F3F5] focus:border-[#59A6B6] focus:ring-1 focus:ring-[#59A6B6] outline-none transition-colors"}),e.jsx("button",{type:"button",onClick:()=>O(!x),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700 hover:cursor-pointer",children:x?e.jsx(A,{size:20}):e.jsx(S,{size:20})}),d&&m&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:m})]})]}),v&&e.jsx("p",{className:"text-red-500 text-sm text-center",children:L(v)}),e.jsx("button",{type:"submit",disabled:u||!M,className:"w-full bg-[#59A6B6] hover:bg-[#4A8A97] hover:cursor-pointer text-white py-3 rounded-xl transition-all duration-200 transform active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",children:u?"Loading...":"Sign Up"})]}),e.jsx("div",{className:"text-center",children:e.jsx("a",{href:"/login",className:"text-sm text-gray-900 font-semibold hover:text-[#59A6B6] transition-colors",children:"Already have an account?"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"relative flex justify-center text-[12px]",children:e.jsx("span",{className:"px-4 text-neutral-900 bg-white font-bold",children:"Or continue with"})})}),e.jsx("button",{type:"button",onClick:U,disabled:u,className:"w-full flex items-center justify-center gap-3",children:e.jsx("div",{className:"px-5 py-3 bg-[#F2F3F5] rounded-xl hover:bg-gray-50 transition-colors hover:cursor-pointer",children:e.jsx(D,{size:35})})})]})]})})}export{de as default}; 2//# sourceMappingURL=Signup-C1EG6OI4.js.map
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.