1import{_ as Y}from"./k5Io-v5u.js";import{_ as D}from"./-TY-d4DB.js";import{_ as M}from"./Caz4cs2_.js";import{h as C,e as U,z as A,r as a,f as F,o as f,c as b,a as c,t as m,k as t,d as p,b as x,l as w,C as S,w as E,q as O,a9 as k}from"./wYx4X3Ud.js";import{s as W}from"./0r9aSOeZ.js";const j={class:"bg-fadedpurple p-6 rounded-lg"},z={class:"text-xl font-bold mb-4"},H={class:"mb-4"},K={class:"flex flex-col gap-4"},L={class:"text-center"},Z={key:0,class:"text-sm text-gray-600"},oe={__name:"VerificationStatus",props:{councilEmail:{type:String,required:!0},userId:{type:String,required:!0},councilId:{type:String,required:!0},type:{type:String,default:"council"}},emits:["verification-success"],setup(I,{expose:T,emit:B}){const o=I,P=B,v=C(()=>o.type==="bid"?"BID":"Council"),R=C(()=>o.type==="bid"?"BID":"council");U();const l=A(),r=a(""),i=a(!1),d=a(60),y=a(!1),u=a(!1),$=n=>{r.value=n,V()};async function V(){var n;try{if(!r.value){l.add({title:"Error",description:"Please enter verification code",color:"red"});return}i.value=!0,console.log("Verifying code for council:",o.councilId);const{data:e,error:s}=await k("/api/verify-council-code",{method:"POST",body:{userId:o.userId,councilId:o.councilId,code:r.value}},"$cPKYqjpHmV");if(s.value)throw new Error(((n=s.value.data)==null?void 0:n.message)||"Verification failed");u.value=!0,setTimeout(()=>{P("verification-success",e.value)},1500)}catch(e){console.error("Verification error:",e),l.add({title:"Error",description:e.message,color:"red"})}finally{i.value=!1}}async function q(){var n;try{i.value=!0,console.log("Resending code for:",{email:o.councilEmail,userId:o.userId,councilId:o.councilId});const{data:e,error:s}=await k("/api/resend-council-verification",{method:"POST",body:{email:o.councilEmail,userId:o.userId,councilId:o.councilId}},"$h62dZPWTe1");if(s.value)throw new Error(((n=s.value.data)==null?void 0:n.message)||"Failed to resend verification");l.add({title:"Success",description:"Verification code resent",color:"green"}),g()}catch(e){console.error("Resend error:",e),l.add({title:"Error",description:e.message,color:"red"})}finally{i.value=!1}}function g(){d.value=60,y.value=!1;const n=W(()=>{d.value--,d.value<=0&&(clearInterval(n),y.value=!0)},1e3)}return F(()=>{g()}),T({startCountdown:g}),(n,e)=>{const s=Y,h=D,N=M;return f(),b("div",j,[c("h3",z,"Verify Your "+m(t(v))+" Account",1),c("p",H,[e[2]||(e[2]=p(" We've sent a verification code to ")),c("strong",null,m(I.councilEmail),1),e[3]||(e[3]=p(". Please enter the 6-character code below: "))]),c("div",K,[x(s,{modelValue:t(r),"onUpdate:modelValue":e[0]||(e[0]=_=>w(r)?r.value=_:null),onComplete:$},null,8,["modelValue"]),t(r).length===6?(f(),S(h,{key:0,onClick:V,loading:t(i),color:"purple",class:"bg-purple font-bold"},{default:E(()=>[p(" Verify "+m(t(v))+" Account ",1)]),_:1},8,["loading"])):O("",!0),c("div",L,[t(y)?(f(),S(h,{key:1,onClick:q,variant:"ghost",loading:t(i),class:"text-sm"},{default:E(()=>e[4]||(e[4]=[p(" Resend verification code ")])),_:1},8,["loading"])):(f(),b("p",Z," You can resend the code in "+m(t(d))+" seconds ",1))])]),x(N,{modelValue:t(u),"onUpdate:modelValue":e[1]||(e[1]=_=>w(u)?u.value=_:null),title:`${t(v)} Verified!`,description:`Your ${t(R)} account has been verified successfully. Redirecting...`},null,8,["modelValue","title","description"])])}}};export{oe as _};
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.