import{_ as v}from"./InputError.vue_vue_type_script_setup_true_lang-rMzOKLUE.js";import{_ as y}from"./index-C32fBP6Q.js";import{_ as V}from"./Input.vue_vue_type_script_setup_true_lang-C2RPzpSC.js";import{_ as B,a as E,b as F}from"./PinInputSlot.vue_vue_type_script_setup_true_lang-ChPnazKU.js";import{_ as N}from"./AuthLayout.vue_vue_type_script_setup_true_lang-7K5JbaF3.js";import{s as g}from"./index-DnLC8ybD.js";import{d as j,m as x,r as b,o as d,g as f,w as a,b as n,e as t,h as R,f as o,aq as h,N as C,a as q,F as A,n as P,i as k,t as w}from"./app-bWy6VYs1.js";import"./index-CMWG4mbA.js";import"./useForwardExpose-Cx2E44RD.js";import"./VisuallyHidden-0BfmsMPn.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./VisuallyHiddenInput-DpGfVqSD.js";const D={class:"space-y-6"},I=["value"],L={class:"flex flex-col items-center justify-center space-y-3 text-center"},M={class:"flex w-full items-center justify-center"},S={class:"text-center text-sm text-muted-foreground"},U=["onClick"],z={class:"text-center text-sm text-muted-foreground"},G=["onClick"],ae=j({__name:"TwoFactorChallenge",setup(H){const l=x(()=>r.value?{title:"Recovery Code",description:"Please confirm access to your account by entering one of your emergency recovery codes.",toggleText:"login using an authentication code"}:{title:"Authentication Code",description:"Enter the authentication code provided by your authenticator application.",toggleText:"login using a recovery code"}),r=b(!1),p=_=>{r.value=!r.value,_(),s.value=[]},s=b([]),$=x(()=>s.value.join(""));return(_,e)=>(d(),f(N,{title:l.value.title,description:l.value.description},{default:a(()=>[n(t(R),{title:"Two-Factor Authentication"}),o("div",D,[r.value?(d(),f(t(h),C({key:1},t(g).form(),{class:"space-y-4","reset-on-error":""}),{default:a(({errors:i,processing:u,clearErrors:c})=>[n(t(V),{name:"recovery_code",type:"text",placeholder:"Enter recovery code",autofocus:r.value,required:""},null,8,["autofocus"]),n(v,{message:i.recovery_code},null,8,["message"]),n(t(y),{type:"submit",class:"w-full",disabled:u},{default:a(()=>[...e[4]||(e[4]=[k("Continue",-1)])]),_:1},8,["disabled"]),o("div",z,[e[5]||(e[5]=o("span",null,"or you can ",-1)),o("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:()=>p(c)},w(l.value.toggleText),9,G)])]),_:1},16)):(d(),f(t(h),C({key:0},t(g).form(),{class:"space-y-4","reset-on-error":"",onError:e[1]||(e[1]=i=>s.value=[])}),{default:a(({errors:i,processing:u,clearErrors:c})=>[o("input",{type:"hidden",name:"code",value:$.value},null,8,I),o("div",L,[o("div",M,[n(t(B),{id:"otp",placeholder:"○",modelValue:s.value,"onUpdate:modelValue":e[0]||(e[0]=m=>s.value=m),type:"number",otp:""},{default:a(()=>[n(t(E),null,{default:a(()=>[(d(),q(A,null,P(6,(m,T)=>n(t(F),{key:m,index:T,disabled:u,autofocus:""},null,8,["index","disabled"])),64))]),_:2},1024)]),_:2},1032,["modelValue"])]),n(v,{message:i.code},null,8,["message"])]),n(t(y),{type:"submit",class:"w-full",disabled:u},{default:a(()=>[...e[2]||(e[2]=[k("Continue",-1)])]),_:1},8,["disabled"]),o("div",S,[e[3]||(e[3]=o("span",null,"or you can ",-1)),o("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:()=>p(c)},w(l.value.toggleText),9,U)])]),_:1},16))])]),_:1},8,["title","description"]))}});export{ae as default};
