1import{u as S,r as c,a as L,j as e,B as m,L as N}from"./index-Bidt7FvI.js";import{I as T}from"./input-Cm9-CwpP.js";import{L as u}from"./label-GLhTkpJY.js";import{I as O,a as P,b}from"./input-otp-Tw3Z7CuF.js";const I=()=>{const{signIn:o,verifyOtp:p,authState:h}=S(),{isLoading:a,error:d}=h,[n,g]=c.useState(""),{toast:i}=L(),[x,f]=c.useState("email"),[r,j]=c.useState(!1),[l,v]=c.useState(""),y=async s=>{if(s.preventDefault(),!n){i({title:"Email is required",description:"Please enter your email address",variant:"destructive"});return}try{await o("email",n),i({title:"Magic link sent",description:"Check your email for a magic link and one-time code to finish signup"}),j(!0),f("otp")}catch(t){i({title:"Signup failed",description:t instanceof Error?t.message:"Failed to send magic link",variant:"destructive"})}},w=async s=>{if(s.preventDefault(),!n||!l){i({title:"Missing information",description:"Please enter your email and the OTP you received.",variant:"destructive"});return}try{await p(n,l),i({title:"Signed up with OTP",description:"You are now signed up. Welcome!"})}catch(t){i({title:"Signup failed",description:t instanceof Error?t.message:"Failed to sign up with OTP.",variant:"destructive"})}},C=async s=>{try{await o(s)}catch(t){i({title:"Signup failed",description:t instanceof Error?t.message:"Failed to sign up",variant:"destructive"})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/images/typeup_black.svg",alt:"TypeUp Logo",className:"h-12 w-auto"})}),e.jsx("p",{className:"text-gray-500",children:"Sign up to get started with TypeUp"})]}),e.jsxs("form",{onSubmit:x==="otp"?w:y,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"email",children:"Email"}),e.jsx(T,{id:"email",type:"email",placeholder:"[email protected]",value:n,onChange:s=>g(s.target.value),disabled:a||r,autoComplete:"username"})]}),r&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"otp",children:"Enter One-Time Passcode (OTP)"}),e.jsx(O,{maxLength:6,value:l,onChange:s=>v(s),autoFocus:!0,containerClassName:"justify-center",children:e.jsx(P,{children:Array.from({length:6}).map((s,t)=>e.jsx(b,{index:t},t))})})]}),e.jsx(m,{type:"submit",className:"w-full",disabled:a||r&&l.length!==6,children:r?a?"Signing Up...":"Sign Up with OTP":a?"Sending Magic Link...":"Send Magic Link"}),r&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Check your email for a magic link and your 6-digit sign-in code."})]}),e.jsxs("div",{className:"relative my-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-white px-2 text-muted-foreground",children:"Or continue with"})})]}),e.jsxs(m,{variant:"outline",className:"w-full flex items-center justify-center gap-2",onClick:()=>C("google"),disabled:a,children:[e.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",xmlns:"http://www.w3.org/2000/svg",className:"mr-2",children:e.jsxs("g",{transform:"matrix(1, 0, 0, 1, 27.009001, -39.238998)",children:[e.jsx("path",{fill:"#4285F4",d:"M -3.264 51.509 C -3.264 50.719 -3.334 49.969 -3.454 49.239 L -14.754 49.239 L -14.754 53.749 L -8.284 53.749 C -8.574 55.229 -9.424 56.479 -10.684 57.329 L -10.684 60.329 L -6.824 60.329 C -4.564 58.239 -3.264 55.159 -3.264 51.509 Z"}),e.jsx("path",{fill:"#34A853",d:"M -14.754 63.239 C -11.514 63.239 -8.804 62.159 -6.824 60.329 L -10.684 57.329 C -11.764 58.049 -13.134 58.489 -14.754 58.489 C -17.884 58.489 -20.534 56.379 -21.484 53.529 L -25.464 53.529 L -25.464 56.619 C -23.494 60.539 -19.444 63.239 -14.754 63.239 Z"}),e.jsx("path",{fill:"#FBBC05",d:"M -21.484 53.529 C -21.734 52.809 -21.864 52.039 -21.864 51.239 C -21.864 50.439 -21.724 49.669 -21.484 48.949 L -21.484 45.859 L -25.464 45.859 C -26.284 47.479 -26.754 49.299 -26.754 51.239 C -26.754 53.179 -26.284 54.999 -25.464 56.619 L -21.484 53.529 Z"}),e.jsx("path",{fill:"#EA4335",d:"M -14.754 43.989 C -12.984 43.989 -11.404 44.599 -10.154 45.789 L -6.734 42.369 C
1-8.804 40.429 -11.514 39.239 -14.754 39.239 C -19.444 39.239 -23.494 41.939 -25.464 45.859 L -21.484 48.949 C -20.534 46.099 -17.884 43.989 -14.754 43.989 Z"})]})}),"Sign up with Google"]}),d&&e.jsx("div",{className:"p-3 text-sm text-red-500 bg-red-50 rounded-md",children:d}),e.jsxs("div",{className:"text-center text-sm text-gray-500",children:["Already have an account?"," ",e.jsx(N,{to:"/login",className:"text-primary font-medium hover:underline",children:"Sign in"})]})]})};export{I 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.