import{a as I,r as d,D as z,c as D,p as h,u as y,v as A,w as S,b as B,W as C,M as F,e as f,aL as K,b6 as p,K as $,X as g,aN as E}from"./jwt-decode.esm-DyyavT6h.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c=new Error().stack;c&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[c]="707add6b-194f-4580-9808-8858aa51170d",s._sentryDebugIdIdentifier="sentry-dbid-707add6b-194f-4580-9808-8858aa51170d")}catch{}})();const T=I({__name:"OTPInput",props:{value:{},length:{},masked:{type:Boolean},numeric:{type:Boolean},size:{}},emits:["update:value","collect-token"],setup(s,{emit:c}){const o=s,i=c,a=d(Array(o.length).fill("")),l=d([]),m=(e,t)=>{let n=e.target.value??"";for(a.value[t].length>0&&n.length>1&&(n=n.slice(1)),o.numeric&&(n=n.replace(/\D/g,""));t<o.length&&n.length;)a.value[t++]=n.charAt(0),n=n.slice(1);i("update:value",a.value.join("").trim()),t-1<o.length-1&&a.value[t-1]!==""&&g(()=>l.value[t].focus())},w=e=>{const t=a.value[e]==="";a.value[e]="",i("update:value",a.value.join("").trim()),a.value[e]===""&&e>0&&t&&g(()=>l.value[e-1].focus())},_=async e=>{e>0&&(l.value[e-1].focus(),v(e-1))},b=async e=>{e<o.length-1&&l.value[e+1].focus()},v=e=>{requestAnimationFrame(()=>{l.value[e].setSelectionRange(1,1)})};z(()=>{l.value.length>0&&l.value[0].focus()});const k=D(()=>({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)=>(f(),h(y(A),{gap:"small",justify:"center"},{default:S(()=>[(f(!0),B(F,null,C(a.value,(n,u)=>(f(),h(y(K),{key:u,ref_for:!0,ref_key:"inputs",ref:l,value:a.value[u],type:s.masked?"password":"text",style:$(k.value),class:"otp-input",onFocus:r=>v(u),onChange:r=>m(r,u),onKeydown:[p(r=>w(u),["delete"]),p(r=>_(u),["left"]),p(r=>b(u),["right"])],onKeyup:t[0]||(t[0]=p(r=>i("collect-token"),["enter"]))},null,8,["value","type","style","onFocus","onChange","onKeydown"]))),128))]),_:1}))}}),L=E(T,[["__scopeId","data-v-7ff63456"]]);export{L as O};
//# sourceMappingURL=OTPInput-CPuVANSf.js.map
