import{e as I,r as d,M as z,b as A,n as h,p as g,b5 as D,w as B,f as F,V as S,H as C,g as i,ah as E,F as T,W as v,aM as j}from"./jwt-decode.esm-C7p7KYmD.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]="52dc48de-530e-4551-b17c-3da9dbb27b1a",l._sentryDebugIdIdentifier="sentry-dbid-52dc48de-530e-4551-b17c-3da9dbb27b1a")}catch{}})();const K=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,p=r,a=d(Array(o.length).fill("")),n=d([]),y=(e,t)=>{switch(e.key){case"Delete":case"Backspace":b(t);break;case"ArrowLeft":w(t);break;case"ArrowRight":k(t);break;case"Enter":p("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);p("update:value",a.value.join("").trim()),t-1<o.length-1&&a.value[t-1]!==""&&v(()=>n.value[t].focus())},b=e=>{const t=a.value[e]==="";a.value[e]="",p("update:value",a.value.join("").trim()),a.value[e]===""&&e>0&&t&&v(()=>n.value[e-1].focus())},w=async e=>{e>0&&(n.value[e-1].focus(),f(e-1))},k=async e=>{e<o.length-1&&n.value[e+1].focus()},f=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(g(D),{gap:"small",justify:"center"},{default:B(()=>[(i(!0),F(C,null,S(a.value,(s,u)=>(i(),h(g(E),{key:u,ref_for:!0,ref_key:"inputs",ref:n,value:a.value[u],type:l.masked?"password":"text",style:T(_.value),class:"otp-input",onFocus:c=>f(u),onChange:c=>m(c,u),onKeydown:c=>y(c,u)},null,8,["value","type","style","onFocus","onChange","onKeydown"]))),128))]),_:1}))}}),M=j(K,[["__scopeId","data-v-185f3e56"]]);export{M as O};
//# sourceMappingURL=OTPInput-Dgj6D_cS.js.map
