1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CkP0Ysi6.js","assets/vendor-react-Dak0qFzn.js","assets/vendor-ui-B9Hlh5h7.js","assets/vendor-icons-DQbXH2Ms.js","assets/index-B8ZrfbzY.css"])))=>i.map(i=>d[i]); 2import{bF as E,h as S,C as _,b_ as k,i as R,I as V,B as P,c1 as T,c2 as F,c3 as I}from"./index-CkP0Ysi6.js";import{c as L,d as B,r as i,j as a}from"./vendor-react-Dak0qFzn.js";import"./vendor-ui-B9Hlh5h7.js";import"./vendor-icons-DQbXH2Ms.js";function q(){const{user:p}=E(),h=L(),y=B().state?.verificationCode??null,[c,d]=i.useState(["","","","","",""]),[u,o]=i.useState(null),[f,m]=i.useState(!1),[x,g]=i.useState(!1),[K,v]=i.useState(y),l=i.useRef([]);function b(e,s){const t=s.replace(/\D/g,"").slice(-1),r=[...c];r[e]=t,d(r),t&&e<5&&l.current[e+1]?.focus()}function j(e,s){s.key==="Backspace"&&!c[e]&&e>0&&l.current[e-1]?.focus()}function N(e){e.preventDefault();const s=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6);if(s.length>0){const t=[...c];for(let n=0;n<6;n++)t[n]=s[n]||"";d(t);const r=t.findIndex(n=>!n);l.current[r===-1?5:r]?.focus()}}async function C(e){e.preventDefault(),o(null);const s=c.join("");if(s.length!==6){o("Please enter all 6 digits");return}m(!0);try{const t=await T(s);if(t.accessToken){const{setToken:r}=await F(async()=>{const{setToken:n}=await import("./index-CkP0Ysi6.js").then(w=>
2w.ey);return{setToken:n}},__vite__mapDeps([0,1,2,3,4]));r(t.accessToken)}h("/dashboard",{replace:!0})}catch(t){o(t instanceof Error?t.message:"Verification failed")}finally{m(!1)}}async function D(){g(!0),o(null);try{const e=await I();v(e.verificationCode),d(["","","","","",""]),l.current[0]?.focus()}catch(e){o(e instanceof Error?e.message:"Failed to resend code")}finally{g(!1)}}return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted/40 px-4",children:a.jsxs(S,{className:"w-full max-w-sm",children:[a.jsxs(_,{className:"text-center pb-2",children:[a.jsx(k,{className:"mb-2"}),a.jsx("h2",{className:"text-lg font-semibold",children:"Verify your email"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["We sent a 6-digit code to"," ",a.jsx("span",{className:"font-medium text-foreground",children:p?.email??"your email"})]})]}),a.jsxs(R,{children:[!1,u&&a.jsx("div",{className:"mb-4 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:u}),a.jsxs("form",{onSubmit:C,className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center gap-2",children:c.map((e,s)=>a.jsx(V,{ref:t=>{l.current[s]=t},type:"text",inputMode:"numeric",maxLength:1,value:e,onChange:t=>b(s,t.target.value),onKeyDown:t=>j(s,t),onPaste:s===0?N:void 0,className:"h-12 w-12 text-center text-lg font-semibold",autoFocus:s===0},s))}),a.jsx(P,{type:"submit",className:"w-full",disabled:f,children:f?"Verifying...":"Verify email"})]}),a.jsx("div",{className:"mt-4 text-center",children:a.jsx("button",{type:"button",onClick:D,disabled:x,className:"text-sm text-muted-foreground hover:text-primary underline-offset-4 hover:underline disabled:opacity-50",children:x?"Sending...":"Didn't receive a code? Resend"})})]})]})})}export{q 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.