import{e as I,r as d,N as z,b as A,f as h,j as y,J as D,w as B,y as S,a2 as C,V as E,h as i,al as F,U as j,a3 as v,aO as O}from"./jwt-decode.esm-BJTSBhUK.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[r]="646eb4df-52d0-4cce-83b7-f3f20a9409d7",l._sentryDebugIdIdentifier="sentry-dbid-646eb4df-52d0-4cce-83b7-f3f20a9409d7")}catch{}})();const T=I({__name:"OTPInput",props:{value:{},length:{},masked:{type:Boolean},numeric:{type:Boolean},size:{}},emits:["update:value","collect-token"],setup(l,{emit:r}){const o=l,f=r,a=d(Array(o.length).fill("")),n=d([]),g=(e,t)=>{switch(e.key){case"Delete":case"Backspace":w(t);break;case"ArrowLeft":k(t);break;case"ArrowRight":b(t);break;case"Enter":f("collect-token");break}},m=(e,t)=>{let s=e.target.value??"";for(a.value[t].length>0&&s.length>1&&(s=s.slice(1)),o.numeric&&(s=s.replace(/\D/g,""));t<o.length&&s.length;)a.value[t++]=s.charAt(0),s=s.slice(1);f("update:value",a.value.join("").trim()),t-1<o.length-1&&a.value[t-1]!==""&&v(()=>n.value[t].focus())},w=e=>{const t=a.value[e]==="";a.value[e]="",f("update:value",a.value.join("").trim()),a.value[e]===""&&e>0&&t&&v(()=>n.value[e-1].focus())},k=async e=>{e>0&&(n.value[e-1].focus(),p(e-1))},b=async e=>{e<o.length-1&&n.value[e+1].focus()},p=e=>{requestAnimationFrame(()=>{n.value[e].setSelectionRange(1,1)})};z(()=>{n.value.length>0&&n.value[0].focus()});const _=A(()=>({small:{width:"27px",height:"30px",fontSize:"14px"},middle:{width:"32.4px",height:"36px",fontSize:"16px"},large:{width:"39.6px",height:"44px",fontSize:"18px"}})[o.size||"middle"]);return(e,t)=>(i(),h(y(D),{gap:"small",justify:"center"},{default:B(()=>[(i(!0),S(E,null,C(a.value,(s,u)=>(i(),h(y(F),{key:u,ref_for:!0,ref_key:"inputs",ref:n,value:a.value[u],type:l.masked?"password":"text",style:j(_.value),class:"otp-input",onFocus:c=>p(u),onChange:c=>m(c,u),onKeydown:c=>g(c,u)},null,8,["value","type","style","onFocus","onChange","onKeydown"]))),128))]),_:1}))}}),L=O(T,[["__scopeId","data-v-185f3e56"]]);export{L as O};
//# sourceMappingURL=OTPInput-C0tjwO--.js.map
