1import{_ as q}from"./CSHkLFmR.js";import{x as L,l as N,y as P,u as V,e as j,g as h,C as D,c as u,a as s,j as T,k as r,f as k,b as a,w as n,d,h as I,o as c,t as w,A as R}from"./Cny-jMUR.js";import{u as Y}from"./Bhcf4Zif.js";import{s as A}from"./x_rD_Ya3.js";const O={class:"flex min-h-screen justify-center mx-auto max-w-sm pb-16"},U={class:"mt-20 md:mt-40 p-4 sm:p-8 w-sm"},F={key:0,class:"text-center"},G={key:1,class:"text-center"},$={class:"mb-6"},H={key:0,class:"text-sm"},Q={class:"flex flex-col gap-3"},J={key:2,class:"text-center"},K={class:"mb-6"},W={class:"mb-2"},X={class:"flex flex-col gap-3"},Z={key:3,class:"text-center"},ee={class:"mb-6"},te={class:"flex flex-col gap-3"},ie={__name:"confirm",setup(se){const _=Y(),y=L(),f=N(),m=P(),g=h(!0),p=h(!1),i=h(null),x=h(""),v=h(0);V({title:"Email Confirmation - Revby",meta:[{name:"description",content:"Confirm your email address to complete your account setup."}]}),j(async()=>{await B()});async function B(){try{const{token_hash:t,type:e,error:o}=f.query;if(!t&&!e&&!o&&Object.keys(f.query).length===0){await m.push("/dashboard");return}if(y.value&&y.value.email_confirmed_at){i.value="already_confirmed",g.value=!1;return}if(!t||!e)throw new Error("Invalid confirmation link. Missing required parameters.");if(o)throw new Error(decodeURIComponent(o));const{data:l,error:E}=await _.auth.verifyOtp({token_hash:t,type:e});if(E)throw E;i.value="success",M()}catch(t){console.error("Email confirmation error:",t),i.value="error",t.message.includes("expired")?x.value="The confirmation link has expired.":t.message.includes("invalid")?x.value="The confirmation link is invalid.":t.message.includes("already_confirmed")?i.value="already_confirmed":x.value=t.message||"An unexpected error occurred during confirmation."}finally{g.value=!1}}function M(){v.value=5;const t=A(()=>{v.value--,v.value<=0&&(clearInterval(t),b())},1e3)}async function S(){if(!p.value){p.value=!0;try{const t=y.value;if(!(t!=null&&t.email)){await m.push("/login?message=Please login to resend confirmation email");return}const{error:e}=await _.auth.resend({type:"signup",email:t.email});if(e)throw e;const{success:o}=R();o("Confirmation email sent!","Please check your email for the new confirmation link.")}catch(t){console.error("Resend confirmation error:",t);const{error:e}=R();e("Failed to resend email",t.message)}finally{p.value=!1}}}async function b(){await m.push("/dashboard")}async function z(){await m.push("/dashboard/profile")}async function C(){await m.push("/login")}return j(()=>{if(f.query.token_hash){const t={...f.query};delete t.token_hash,delete t.type,delete t.error,D({path:f.path,query:Object.keys(t).length>0?t:void 0},{replace:!0})}}),(t,e)=>{const o=q,l=I;return c(),u("div",O,[s("div",U,[r(g)?(c(),u("div",F,[...e[0]||(e[0]=[s("div",{class:"mb-6"},[s("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-brand mx-auto"})],-1),s("h1",{class:"text-2xl font-bold text-neutral-950 mb-4"},"Confirming Your Email",-1),s("p",{class:"text-gray-600"},"Please wait while we verify your email address...",-1)])])):r(i)==="success"?(c(),u("div",G,[e[4]||(e[4]=k('<div class="mb-6"><div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100"><svg class="h-6 w-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg></div></div><h1 class="text-2xl font-bold text-neutral-950 mb-4">â
Email Confirmed Successfully!</h1>',2)),s("div",$,[a(o,{color:"green",variant:"outline",class:"text-green-600 border-green-500"},{default:n(()=>[e[1]||(e[1]=s("p",{class:"mb-2"},"Your email has been verified. You can now access all features.",-1)),r(v)>0?(c(),u("p",H," Redirecting to your dashboard in "+w(r(v))+" seconds... ",1)):T("",!0)]),_:1})]),s("div",Q,[a(l,{onClick:b,class:"rounded-full px-8 py-2",size:"lg"},{default:n(()=>[...e[2]||(e[2]=[d(" Go to Dashboard ",-1)])]),_:1}),a(l,{onClick:z,variant:"outline",class:"rounded-full px-8 py-2",size:"md"},{default:n(()=>[...e[3]||(e[3]=[d(" Complete Profile ",-1)])]),_:1})])])):r(i)==="error"?(c(),u("div",J,[e[7]||(e[7]=k('<div class="mb-6"><div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100"><svg class="h-6 w-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></div></div><h1 class="text-2xl font-bold text-neutral-950 mb-4">â Confirmation Failed</h1>',2)),s("div",K,[a(o,{color:"red",variant:"outline",class:"text-red-600 border-red-500"},{default:n(()=>[s("p",W,w(r(x)),1),e[5]||(e[5]=s("p",{class:"text-sm text-gray-600"},"The confirmation link may be expired or invalid.",-1))]),_:1})]),s("div",X,[a(l,{onClick:S,loading:r(p),class:"rounded-full px-8 py-2",size:"lg"},{default:n(()=>[d(w(r(p)?"Sending...":"Resend Confirmation Email"),1)]),_:1},8,["loading"]),a(l,{onClick:C,variant:"outline",class:"rounded-full px-8 py-2",size:"md"},{default:n(()=>[...e[6]||(e[6]=[d(" Back to Login ",-1)])]),_:1})]),e[8]||(e[8]=s("p",{class:"mt-6 text-sm text-gray-600"},[d(" Need help? "),s("a",{href:"/contact",class:"text-brand hover:underline"},"Contact Support")],-1))])):r(i)==="already_confirmed"?(c(),u("div",Z,[e[12]||(e[12]=k('<div class="mb-6"><div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-blue-100"><svg class="h-6 w-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div></div><h1 class="text-2xl font-bold text-neutral-950 mb-4">Email Already Confirmed</h1>',2)),s("div",ee,[a(o,{color:"blue",variant:"outline",class:"text-blue-600 border-blue-500"},{default:n(()=>[...e[9]||(e[9]=[s("p",null,"Your email address has already been verified.",-1)])]),_:1})]),s("div",te,[a(l,{onClick:b,class:"rounded-full px-8 py-2",size:"lg"},{default:n(()=>[...e[10]||(e[10]=[d(" Go to Dashboard ",-1)])]),_:1}),a(l,{onClick:C,variant:"outline",class:"rounded-full px-8 py-2",size:"md"},{default:n(()=>[...e[11]||(e[11]=[d(" Login ",-1)])]),_:1})])])):T("",!0)])])}}};export{ie 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.