1import{_ as P,m as M,n as S,b as U,W as j,o as w,c as x,a as o,h as b,t as h,F as L,j as O,i as F,v as K,d as N,f as z,l as d,a1 as H,U as k,k as I}from"./BkE15QU6.js";import{s as W}from"./DJDR6bmI.js";const q={class:"wrapper"},A={class:"max-w-[400px] mx-auto pt-10"},G={class:"mb-8"},J={class:"mb-10"},Q={class:"text-[#667185] text-sm"},X={class:"text-[#1D2739] font-medium"},Y=["id","onUpdate:modelValue","onInput","onKeydown"],Z={class:"mt-8 text-center"},ee={class:"text-[#D42620] font-medium mb-4"},te={class:"text-[#667185] text-sm"},oe=["disabled"],se={__name:"verify-otp",setup(ne){const D=M(),u=S(),m=d(!1),f=d(!1),g=d({}),v=d(""),p=d(""),s=H(["","","","","",""]),r=d(5);let i=null;const $=I(()=>s.every(t=>t!=="")),B=I(()=>{const t=Math.floor(r.value/60),e=r.value%60;return`${t.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`}),y=()=>{i&&clearInterval(i),r.value=59,i=W(()=>{r.value>0?r.value--:clearInterval(i)},1e3)},E=(t,e)=>{const n=t.target.value;if(n.length>1&&(s[e]=n.slice(-1)),!/^\d*$/.test(s[e])){s[e]="";return}if(s[e]&&e<5){const c=document.getElementById(`otp-${e+1}`);c&&c.focus()}},R=(t,e)=>{if(t.key==="Backspace"&&!s[e]&&e>0){const n=document.getElementById(`otp-${e-1}`);n&&(n.focus(),s[e-1]="")}},T=t=>{const e=t.clipboardData.getData("text").trim().slice(0,6);if(!/^\d+$/.test(e))return;const n=e.split("");n.forEach((l,_)=>{_<6&&(s[_]=l)});const c=Math.min(n.length,5),a=document.getElementById(`otp-${c}`);a&&a.focus()},V=async()=>{const t=s.join("");m.value=!0;try{const e=k();if(t.length<6){u.error("Please enter a valid verification code");return}await $fetch(`${e.public.baseURL}/members/verify-otp/${t}`,{method:"POST",body:{email:v.value,otp:t,token:p.value}}),u.success("Verification successful!"),D.push("/auth/login")}catch(e){console.error("Verification error:",e),u.error(e.data?.msg||e.data?.message||"Invalid verification code")}finally{m.value=!1}},C=async()=>{f.value=!0;try{const t=k(),{data:e}=await $fetch(`${t.public.baseURL}/members/v2/resend-otp`,{method:"POST",body:{email:v.value,token:p.value}});p.value=e.token,u.success("Verification code resent"),y()}catch(t){u.error(t.data?.msg||"Failed to resend code")}finally{f.value=!1}};return U(()=>{window.history.state?.user&&(g.value=window.history.state.user,v.value=g.value.email||"",p.value=g.value.token||""),y(),setTimeout(()=>{const t=document.getElementById("otp-0");t&&t.focus()},100)}),j(()=>{i&&clearInterval(i)}),(t,e)=>{const n=z;return w(),x("div",q,[o("div",A,[o("div",G,[o("button",{onClick:e[0]||(e[0]=c=>t.$router.back()),class:"w-10 h-10 flex items-center justify-center rounded-full border border-gray-200 hover:bg-gray-50 transition-colors"},[...e[1]||(e[1]=[o("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M19 12H5M5 12L12 19M5 12L12 5",stroke:"#1D2739","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])]),o("div",J,[e[3]||(e[3]=o("h1",{class:"text-2xl font-bold text-[#1D2739] mb-2"},"Enter Recovery Code",-1)),o("p",Q,[e[2]||(e[2]=b(" Enter the recovery code sent to ",-1)),o("span",X,h(v.value),1)])]),o("div",{class:"flex justify-between gap-2 mb-12",onPaste:T},[(w(),x(L,null,O(6,(c,a)=>F(o("input",{key:a,id:"otp-"+a,type:"text",inputmode:"numeric",maxlength:"1",autocomplete:"one-time-code",class:"w-12 h-14 md:w-14 md:h-16 text-center text-2xl font-bold border border-[#E4E7EC] rounded-xl focus:border-[#D42620] focus:ring-1 focus:ring-[#D42620] outline-none transition-all","onUpdate:modelValue":l=>s[a]=l,onInput:l=>E(l,a),onKeydown:l=>R(l,a)},null,40,Y),[[K,s[a]]])),64))],32),N(n,{label:"Proceed",block:"",theme:"primary",size:"lg",loading:m.value,disabled:!$.value||m.value,onClick:V},null,8,["loading","disabled"]),o("div",Z,[o("div",ee,h(B.value),1),o("p",te,[e[4]||(e[4]=b(" Didnât Receive ",-1)),e[5]||(e[5]=o("span",{class:"font-bold text-[#1D2739]"},"OTP",-1)),e[6]||(e[6]=b(", ",-1)),o("button",{onClick:C,class:"text-[#D42620] font-semibold hover:underline disabled:opacity-50 inline-flex ml-1",disabled:r.value>0||f.value},h(f.value?"Resending...":"Resend Code"),9,oe)])])])])}}},re=P(se,[["__scopeId","data-v-eb107ab4"]]);export{re as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.