import{i as h,d as f,T as w,k as C,e as a,b as o,u as e,w as y,F as s,o as c,Z as V,a as d,g as l,t as i,l as v,s as I}from"./app-WJL2kJBE.js";import{J as B}from"./AuthenticationCard-DsL5pTVv.js";import{_ as T}from"./AuthenticationCardLogo-DfLTNru8.js";import{L as U}from"./LoadingButton-H6RtHB1p.js";import{_ as g}from"./Input-C4-VG2dv.js";import{_ as k}from"./Label-CBaaVbfI.js";import{_ as $}from"./ValidationErrors-Bh9Wy7Xq.js";const F={class:"mb-4 text-sm text-gray-600"},L={key:0},N={key:1},E={class:"flex items-center justify-end mt-4"},q={__name:"TwoFactorChallenge",setup(J){const{t:n}=h({}),r=f(!1),t=w({code:"",recovery_code:""}),p=f(null),_=f(null);C(()=>{document.getElementById("app-loading").style.display="none"});const x=async()=>{r.value^=!0,await I(),r.value?(p.value.focus(),t.code=""):(_.value.focus(),t.recovery_code="")},b=()=>{t.post(route("two-factor.login"))};return(M,u)=>(c(),a(s,null,[o(e(V),{title:e(n)("Two-factor Confirmation")},null,8,["title"]),o(B,null,{logo:y(()=>[o(T)]),default:y(()=>[d("div",F,[r.value?(c(),a(s,{key:1},[l(i(e(n)("Please confirm access to your account by entering one of your emergency recovery codes.")),1)],64)):(c(),a(s,{key:0},[l(i(e(n)("Please confirm access to your account by entering the authentication code provided by your authenticator application.")),1)],64))]),o($,{class:"mb-4"}),d("form",{onSubmit:v(b,["prevent"])},[r.value?(c(),a("div",N,[o(k,{for:"recovery_code",value:"Recovery Code"}),o(g,{id:"recovery_code",ref_key:"recoveryCodeInput",ref:p,modelValue:e(t).recovery_code,"onUpdate:modelValue":u[1]||(u[1]=m=>e(t).recovery_code=m),type:"text",class:"mt-1 block w-full",autocomplete:"one-time-code"},null,8,["modelValue"])])):(c(),a("div",L,[o(k,{for:"code",value:"Code"}),o(g,{id:"code",ref_key:"codeInput",ref:_,modelValue:e(t).code,"onUpdate:modelValue":u[0]||(u[0]=m=>e(t).code=m),type:"text",inputmode:"numeric",class:"mt-1 block w-full",autofocus:"",autocomplete:"one-time-code"},null,8,["modelValue"])])),d("div",E,[d("button",{type:"button",class:"text-sm text-gray-600 hover:text-gray-900 underline cursor-pointer",onClick:v(x,["prevent"])},[r.value?(c(),a(s,{key:1},[l(i(e(n)("Use an authentication code")),1)],64)):(c(),a(s,{key:0},[l(i(e(n)("Use a recovery code")),1)],64))]),o(U,{class:"ml-4",loading:e(t).processing},{default:y(()=>[l(i(e(n)("Log in")),1)]),_:1},8,["loading"])])],32)]),_:1})],64))}};export{q as default};
