1import{t as N,s as C,r,j as e,L as _}from"./vendor-CSpQeQFa.js";import{i as z,s as m,B as g}from"./entry-main-PLc9_a6q.js";import{u as A,A as S}from"./MarketingHeader-DURgYL2j.js";import{C as L,a as E,b as G,d as R,c as B}from"./uploadLimits-Bk-o1hAt.js";import{m as l}from"./brandClaimErrors-DKWl3Kz1.js";import{G as M}from"./BrandWordmark-W5P5jQbV.js";import{S as T}from"./signatureCeremonyModalGuard-vHUWzdXW.js";import{L as x}from"./BonusExpiryCountdown-DZAQV4Wx.js";import{C as D}from"./PendingApproval-BMg-Cjnx.js";import{C as F}from"./modelFamilies-Dcg73pIM.js";const h=z("brand").name,J=()=>{const{token:n}=N(),f=C();A();const[a,s]=r.useState("loading"),[w,b]=r.useState(""),[u,k]=r.useState(""),[v,i]=r.useState(""),[d,o]=r.useState(!1),p=r.useRef(!1);r.useEffect(()=>{p.current||(p.current=!0,y())},[n]);const y=async()=>{if(!n){s("not_found");return}try{const{data:t,error:c}=await m.functions.invoke("auth-brand-claim-v1",{body:{action:"validate",token:n}});if(c||!t?.status){s("error"),i(await l(c,"Could not validate this claim link."));return}s(t.status),b(t.company_name||""),k(t.email_masked||"")}catch(t){s("error"),i(await l(t,"Could not validate this claim link."))}},j=async()=>{if(n){o(!0);try{await m.auth.signOut();const{data:t,error:c}=await m.functions.invoke("auth-brand-claim-v1",{body:{action:"initiate",token:n,origin:window.location.origin}});if(c){s("error"),i(await l(c,"Could not start the claim.")),o(!1);return}if(t?.error){s("error"),i(await l(new Error(t.error),"Could not start the claim.")),o(!1);return}if(!t?.action_link){s("error"),i("Could not start the claim. Please try again or contact support."),o(!1);return}window.location.href=t.action_link}catch(t){s("error"),i(await l(t,"Could not start the claim.")),o(!1)}}};return e.jsxs("div",{className:"min-h-screen bg-white text-zinc-900",children:[e.jsx("div",{className:"pointer-events-none fixed inset-0 bg-[radial-gradient(circle_at_top,rgba(244,244,245,0.95),rgba(255,255,255,0)_42%)]"}),e.jsx("header",{className:"sticky top-0 z-10 border-b border-zinc-200/80 bg-white/90 backdrop-blur-sm",children:e.jsx("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-4",children:e.jsx(_,{to:"/",className:"flex items-center gap-2 text-zinc-900 hover:text-zinc-700","aria-label":"General Creative home",children:e.jsx(M,{surface:"light",className:"h-8",eager:!0})})})}),e.jsx("main",{className:"relative mx-auto flex min-h-[calc(100vh-57px)] max-w-5xl flex-col justify-center px-4 py-8 sm:py-10",children:e.jsxs(L,{className:"mx-auto w-full max-w-2xl rounded-[2rem] border border-zinc-200/80 bg-white shadow-[0_22px_70px_-45px_rgba(15,23,42,0.32)]",children:[e.jsxs(E,{className:"space-y-4 px-6 pt-8 text-center sm:px-8 sm:pt-10",children:[e.jsxs("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-zinc-900 text-white shadow-[0_16px_30px_-18px_rgba(15,23,42,0.6)]",children:[a==="valid"&&e.jsx(T,{className:"h-7 w-7"}),a==="loading"&&e.jsx(x,{className:"h-7 w-7 animate-spin"}),a==="claimed"&&e.jsx(D,{className:"h-7 w-7"}),(a==="revoked"||a==="expired"||a==="not_found"||a==="error")&&e.jsx(F,{className:"h-7 w-7"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(G,{className:"font-serif text-3xl tracking-tight text-zinc-900 sm:text-4xl",children:[a==="valid"&&"Claim your brand account",a==="loading"&&"Checking your linkâ¦",a==="claimed"&&"Already claimed",a==="revoked"&&"Link revoked",a==="expired"&&"Link expired",a==="not_found"&&"Link not found",a==="error"&&"Something went wrong"]}),e.jsxs(R,{className:"text-sm text-zinc-600 sm:text-base",children:[a==="valid"&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{className:"text-zinc-900",children:w}),"'s ",h," account is ready. Click below to sign in and pick your email + how you want to log in going forward."]}),a==="loading"&&"Validating your claim linkâ¦",a==="claimed"&&"This account has already been claimed. Try signing in instead.",a==="revoked"&&`This link has been revoked. Reach out to your ${h} contact for a new one.`,a==="expired"&&`This link has expired. Reach out to your ${h} contact for a new one.`,a==="not_found"&&"We couldn't find a claim with this link.",a==="error"&&(v||"Please try again or c
1ontact support.")]})]})]}),e.jsxs(B,{className:"space-y-6 px-6 pb-8 sm:px-8 sm:pb-10",children:[a==="loading"&&e.jsx("div",{className:"flex flex-col items-center py-6",children:e.jsx(x,{className:"mb-3 h-10 w-10 animate-spin text-zinc-900"})}),a==="valid"&&e.jsxs("div",{className:"space-y-4",children:[u&&e.jsxs("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50/60 px-5 py-4 text-center",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-zinc-500",children:"Delivery email"}),e.jsx("p",{className:"mt-1 font-mono text-sm text-zinc-900",children:u})]}),e.jsxs(g,{onClick:j,disabled:d,className:"min-h-[48px] w-full rounded-xl bg-[#1A1A1A] text-white shadow-[0_16px_36px_rgba(17,24,39,0.18)] transition-colors hover:bg-black",children:[d?e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Get started",!d&&e.jsx(S,{className:"ml-2 h-4 w-4"})]}),e.jsx("p",{className:"text-center text-xs text-zinc-500",children:"You'll be signed in automatically, then choose how to log in next time (password, Google, or Discord)."})]}),(a==="claimed"||a==="revoked"||a==="expired"||a==="not_found"||a==="error")&&e.jsx("div",{className:"space-y-4",children:e.jsx(g,{onClick:()=>f(a==="claimed"?"/auth?type=business":"/"),className:"min-h-[48px] w-full rounded-xl bg-[#1A1A1A] text-white shadow-[0_16px_36px_rgba(17,24,39,0.18)] transition-colors hover:bg-black",children:a==="claimed"?"Go to sign in":"Go home"})})]})]})})]})};export{J 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.