import{J as e,Kt as t,Mt as n,Q as r,Qt as i,R as a,Tn as o,X as s,Xn as c,Y as l,a as u,at as d,fr as f,it as p,n as m,or as h,r as g,st as _,xn as v}from"./dist-CoD0k1Bd.js";import{t as y}from"./Input-C3DwKNOf.js";import{t as b}from"./button-mN_poAXs.js";import{t as x}from"./InputError-BY5lDrFd.js";import{a as S,i as C,n as w,r as T}from"./login-DwTk_V9d.js";var E={class:`space-y-6`},D=[`value`],O={class:`flex flex-col items-center justify-center space-y-3 text-center`},k={class:`flex w-full items-center justify-center`},A={class:`text-center text-sm text-muted-foreground`},j=[`onClick`],M={class:`text-center text-sm text-muted-foreground`},N=[`onClick`],P=_({__name:`TwoFactorChallenge`,setup(_){let P=c(!1),F=c(``),I=e(()=>P.value?{title:`Recovery code`,description:`Please confirm access to your account by entering one of your emergency recovery codes.`,buttonText:`login using an authentication code`}:{title:`Authentication code`,description:`Enter the authentication code provided by your authenticator application.`,buttonText:`login using a recovery code`});v(()=>{u({title:I.value.title,description:I.value.description})});let L=e=>{P.value=!P.value,e(),F.value=``};return(e,c)=>(t(),r(a,null,[d(h(g),{title:`Two-factor authentication`}),l(`div`,E,[P.value?(t(),s(h(m),n({key:1},h(w).form(),{class:`space-y-4`,"reset-on-error":``}),{default:o(({errors:e,processing:t,clearErrors:n})=>[d(h(y),{name:`recovery_code`,type:`text`,placeholder:`Enter recovery code`,autofocus:P.value,required:``},null,8,[`autofocus`]),d(x,{message:e.recovery_code},null,8,[`message`]),d(h(b),{type:`submit`,class:`w-full`,disabled:t},{default:o(()=>[...c[4]||=[p(`Continue`,-1)]]),_:1},8,[`disabled`]),l(`div`,M,[c[5]||=l(`span`,null,`or you can `,-1),l(`button`,{type:`button`,class:`text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500`,onClick:()=>L(n)},f(I.value.buttonText),9,N)])]),_:1},16)):(t(),s(h(m),n({key:0},h(w).form(),{class:`space-y-4`,"reset-on-error":``,onError:c[1]||=e=>F.value=``}),{default:o(({errors:e,processing:n,clearErrors:s})=>[l(`input`,{type:`hidden`,name:`code`,value:F.value},null,8,D),l(`div`,O,[l(`div`,k,[d(h(S),{id:`otp`,modelValue:F.value,"onUpdate:modelValue":c[0]||=e=>F.value=e,maxlength:6,disabled:n,autofocus:``},{default:o(()=>[d(h(C),null,{default:o(()=>[(t(),r(a,null,i(6,e=>d(h(T),{key:e,index:e-1},null,8,[`index`])),64))]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),d(x,{message:e.code},null,8,[`message`])]),d(h(b),{type:`submit`,class:`w-full`,disabled:n},{default:o(()=>[...c[2]||=[p(`Continue`,-1)]]),_:1},8,[`disabled`]),l(`div`,A,[c[3]||=l(`span`,null,`or you can `,-1),l(`button`,{type:`button`,class:`text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500`,onClick:()=>L(s)},f(I.value.buttonText),9,j)])]),_:1},16))])],64))}});export{P as default};