import{A as e,B as t,C as n,D as r,J as i,K as a,M as o,T as s,a as c,b as l,gt as u,it as d,j as f,kt as p,n as m,ot as h,r as g,w as _,wt as v}from"./dist-B4ulKgpj.js";import{t as y}from"./Input-DUc0hUPv.js";import{l as b}from"./app-DUC9tg6Z.js";import{t as x}from"./InputError-whMZ-BCS.js";import{a as S,i as C,n as w,r as T}from"./login-RWR2YNYs.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=o({__name:`TwoFactorChallenge`,setup(o){let P=n(()=>F.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`});d(()=>{c({title:P.value.title,description:P.value.description})});let F=u(!1),I=e=>{F.value=!F.value,e(),L.value=``},L=u(``);return(n,o)=>(a(),r(l,null,[f(v(g),{title:`Two-factor authentication`}),_(`div`,E,[F.value?(a(),s(v(m),t({key:1},v(w).form(),{class:`space-y-4`,"reset-on-error":``}),{default:h(({errors:t,processing:n,clearErrors:r})=>[f(v(y),{name:`recovery_code`,type:`text`,placeholder:`Enter recovery code`,autofocus:F.value,required:``},null,8,[`autofocus`]),f(x,{message:t.recovery_code},null,8,[`message`]),f(v(b),{type:`submit`,class:`w-full`,disabled:n},{default:h(()=>[...o[4]||=[e(`Continue`,-1)]]),_:1},8,[`disabled`]),_(`div`,M,[o[5]||=_(`span`,null,`or you can `,-1),_(`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:()=>I(r)},p(P.value.buttonText),9,N)])]),_:1},16)):(a(),s(v(m),t({key:0},v(w).form(),{class:`space-y-4`,"reset-on-error":``,onError:o[1]||=e=>L.value=``}),{default:h(({errors:t,processing:n,clearErrors:s})=>[_(`input`,{type:`hidden`,name:`code`,value:L.value},null,8,D),_(`div`,O,[_(`div`,k,[f(v(S),{id:`otp`,modelValue:L.value,"onUpdate:modelValue":o[0]||=e=>L.value=e,maxlength:6,disabled:n,autofocus:``},{default:h(()=>[f(v(C),null,{default:h(()=>[(a(),r(l,null,i(6,e=>f(v(T),{key:e,index:e-1},null,8,[`index`])),64))]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),f(x,{message:t.code},null,8,[`message`])]),f(v(b),{type:`submit`,class:`w-full`,disabled:n},{default:h(()=>[...o[2]||=[e(`Continue`,-1)]]),_:1},8,[`disabled`]),_(`div`,A,[o[3]||=_(`span`,null,`or you can `,-1),_(`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:()=>I(s)},p(P.value.buttonText),9,j)])]),_:1},16))])],64))}});export{P as default};