import{_ as e,a as t,b as n,i as r,o as i,s as a,u as o,v as s}from"./i18n-DfIivedY.js";import{Dt as c,Et as l}from"./app-BUWZBqJJ.js";import{t as u}from"./input-error-DINAq-Y-.js";import{a as d,c as f,n as p,r as m,s as h}from"./styles-CjVbMPwe.js";import{c as g,l as _,o as v,s as y,u as b}from"./use-two-factor-auth-VxrtJJfH.js";var x=e(),S=n(s(),1),C=t();function w(){let e=(0,x.c)(39),{t}=r(),[n,s]=(0,S.useState)(!1),[h,_]=(0,S.useState)(``),w;bb0:{if(n){let n;e[0]===t?n=e[1]:(n=t(`Recovery code`),e[0]=t,e[1]=n);let r;e[2]===t?r=e[3]:(r=t(`Please confirm access to your account by entering one of your emergency recovery codes.`),e[2]=t,e[3]=r);let i;e[4]===t?i=e[5]:(i=t(`login using an authentication code`),e[4]=t,e[5]=i);let a;e[6]!==n||e[7]!==r||e[8]!==i?(a={title:n,description:r,toggleText:i},e[6]=n,e[7]=r,e[8]=i,e[9]=a):a=e[9],w=a;break bb0}let r;e[10]===t?r=e[11]:(r=t(`Authentication code`),e[10]=t,e[11]=r);let i;e[12]===t?i=e[13]:(i=t(`Enter the authentication code provided by your authenticator application.`),e[12]=t,e[13]=i);let a;e[14]===t?a=e[15]:(a=t(`login using a recovery code`),e[14]=t,e[15]=a);let o;e[16]!==r||e[17]!==i||e[18]!==a?(o={title:r,description:i,toggleText:a},e[16]=r,e[17]=i,e[18]=a,e[19]=o):o=e[19],w=o}let E=w;o({title:E.title,description:E.description});let D;e[20]===n?D=e[21]:(D=e=>{s(!n),e(),_(``)},e[20]=n,e[21]=D);let O=D,k;e[22]===t?k=e[23]:(k=t(`Two-factor authentication`),e[22]=t,e[23]=k);let A;e[24]===k?A=e[25]:(A=(0,C.jsx)(a,{title:k}),e[24]=k,e[25]=A);let j;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=v.form(),e[26]=j):j=e[26];let M=!n,N;e[27]!==E.toggleText||e[28]!==h||e[29]!==n||e[30]!==t||e[31]!==O?(N=e=>{let{errors:r,processing:i,clearErrors:a}=e;return(0,C.jsxs)(C.Fragment,{children:[n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(l,{name:`recovery_code`,type:`text`,placeholder:t(`Enter recovery code`),className:`${m} text-center font-mono tracking-[0.25em]`,autoFocus:n,required:!0}),(0,C.jsx)(u,{message:r.recovery_code})]}):(0,C.jsxs)(`div`,{className:`flex flex-col items-center justify-center space-y-4 rounded-[20px] border border-[#e1dacd] bg-[#f7f2ea] p-5 text-center`,children:[(0,C.jsx)(`div`,{className:`flex w-full items-center justify-center`,children:(0,C.jsx)(y,{name:`code`,maxLength:6,value:h,onChange:e=>_(e),disabled:i,pattern:b,autoFocus:!0,containerClassName:`justify-center gap-2.5`,children:(0,C.jsx)(g,{className:`gap-2.5`,children:Array.from({length:6},T)})})}),(0,C.jsx)(u,{message:r.code})]}),(0,C.jsx)(c,{type:`submit`,className:`${f} w-full`,disabled:i,children:t(`Continue`)}),(0,C.jsxs)(`div`,{className:`text-center ${p}`,children:[(0,C.jsxs)(`span`,{children:[t(`or you can`),` `]}),(0,C.jsx)(`button`,{type:`button`,className:`cursor-pointer ${d}`,onClick:()=>O(a),children:E.toggleText})]})]})},e[27]=E.toggleText,e[28]=h,e[29]=n,e[30]=t,e[31]=O,e[32]=N):N=e[32];let P;e[33]!==M||e[34]!==N?(P=(0,C.jsx)(`div`,{className:`space-y-6`,children:(0,C.jsx)(i,{...j,className:`space-y-5`,resetOnError:!0,resetOnSuccess:M,children:N})}),e[33]=M,e[34]=N,e[35]=P):P=e[35];let F;return e[36]!==A||e[37]!==P?(F=(0,C.jsxs)(C.Fragment,{children:[A,P]}),e[36]=A,e[37]=P,e[38]=F):F=e[38],F}function T(e,t){return(0,C.jsx)(_,{index:t,className:h},t)}export{w as default};