import{n as e}from"./rolldown-runtime-CbXtAM7H.js";import{a as t,c as n,i as r,n as i,p as a,r as o}from"./createLucideIcon-P71pXhjD.js";import{t as s}from"./button-6mRKmJ-z.js";import{f as c}from"./app-AaPQHUQ2.js";import{t as l}from"./input-error-BiLRn-Z7.js";import{c as u,l as d,o as f,s as p,u as m}from"./use-two-factor-auth-Gby5G4a3.js";var h=o(),g=e(a(),1),_=i();function v(){let e=(0,h.c)(14),[i,a]=(0,g.useState)(!1),[o,d]=(0,g.useState)(``),v;bb0:{if(i){let t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={title:`Recovery code`,description:`Please confirm access to your account by entering one of your emergency recovery codes.`,toggleText:`login using an authentication code`},e[0]=t):t=e[0],v=t;break bb0}let t;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t={title:`Authentication code`,description:`Enter the authentication code provided by your authenticator application.`,toggleText:`login using a recovery code`},e[1]=t):t=e[1],v=t}let b=v;n({title:b.title,description:b.description});let x;e[2]===i?x=e[3]:(x=e=>{a(!i),e(),d(``)},e[2]=i,e[3]=x);let S=x,C;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,_.jsx)(t,{title:`Two-factor authentication`}),e[4]=C):C=e[4];let w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=f.form(),e[5]=w):w=e[5];let T=!i,E;e[6]!==b.toggleText||e[7]!==o||e[8]!==i||e[9]!==S?(E=e=>{let{errors:t,processing:n,clearErrors:r}=e;return(0,_.jsxs)(_.Fragment,{children:[i?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{name:`recovery_code`,type:`text`,placeholder:`Enter recovery code`,autoFocus:i,required:!0}),(0,_.jsx)(l,{message:t.recovery_code})]}):(0,_.jsxs)(`div`,{className:`flex flex-col items-center justify-center space-y-3 text-center`,children:[(0,_.jsx)(`div`,{className:`flex w-full items-center justify-center`,children:(0,_.jsx)(p,{name:`code`,maxLength:6,value:o,onChange:e=>d(e),disabled:n,pattern:m,autoFocus:!0,children:(0,_.jsx)(u,{children:Array.from({length:6},y)})})}),(0,_.jsx)(l,{message:t.code})]}),(0,_.jsx)(s,{type:`submit`,className:`w-full`,disabled:n,children:`Continue`}),(0,_.jsxs)(`div`,{className:`text-center text-sm text-muted-foreground`,children:[(0,_.jsx)(`span`,{children:`or you can `}),(0,_.jsx)(`button`,{type:`button`,className:`cursor-pointer text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500`,onClick:()=>S(r),children:b.toggleText})]})]})},e[6]=b.toggleText,e[7]=o,e[8]=i,e[9]=S,e[10]=E):E=e[10];let D;return e[11]!==T||e[12]!==E?(D=(0,_.jsxs)(_.Fragment,{children:[C,(0,_.jsx)(`div`,{className:`space-y-6`,children:(0,_.jsx)(r,{...w,className:`space-y-4`,resetOnError:!0,resetOnSuccess:T,children:E})})]}),e[11]=T,e[12]=E,e[13]=D):D=e[13],D}function y(e,t){return(0,_.jsx)(d,{index:t},t)}export{v as default};