import{q as m,r as f,y as s,z as _,J as b,K as g,U as v,I as y,D as a,L as h,A as x}from"./EchoChannel-Bg1-kez_.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";const D={class:"flex flex-col relative"},q={class:"w-fit mx-auto sm:mx-0 grid grid-cols-3 sm:grid-cols-6 gap-2"},C=["value","onInput","onPaste"],A={key:0,class:"text-qorus-red"},B=m({__name:"FormCode",props:{required:{type:Boolean},error:{}},emits:["change"],setup(F,{emit:l}){const t=f({index:0,code:[null,null,null,null,null,null]}),c=l,i=function(e,o){t.code[o]=Number(e.data)||0,t.index=o+1,o>=5&&c("change",parseInt(t.code.join("")))},d=function(e,o){e.clipboardData&&e.clipboardData.getData("text")&&([...Array.from(e.clipboardData.getData("text"))].every(r=>(t.code[o]=Number(r)||0,o++,o<6)),t.index=o,o>=6&&c("change",parseInt(t.code.join(""))))},p={mounted:(e,o)=>{o.value.index===t.index?e.focus():e.blur()},updated:(e,o)=>{o.value.index===t.index?e.focus():e.blur()}};return(e,o)=>(a(),s("div",D,[_("div",q,[(a(!0),s(b,null,g(t.code,(u,r)=>h((a(),s("input",{class:x(["w-16 border border-qorus-grey-light border-solid py-2 px-4 outline-2 focus:outline focus:outline-qorus-purple",{"border-qorus-red":e.error}]),value:u,type:"number",onInput:n=>i(n,r),onPaste:n=>d(n,r)},null,42,C)),[[p,{index:r,focusIndex:t.index}]])),256))]),e.error?(a(),s("div",A,v(e.error),1)):y("",!0)]))}}),w=I(B,[["__scopeId","data-v-8abcc274"]]);export{w as default};