1import{a1 as X,r as s,j as e,_ as b,m as r,L as j,a2 as R,Z as v,B as d,C as E,a3 as F,d as I}from"./index-C0-3lqMC.js";import{A as U}from"./arrow-up-ym3r8RYG.js";import{T as W}from"./ticket-QP2iM1qZ.js";const n={hidden:{opacity:0,y:10},show:{opacity:1,y:0}};function B(){const{user:w}=X(),[t,N]=s.useState(null),[k,h]=s.useState(!0),[m,x]=s.useState(!1),[l,y]=s.useState(""),[u,o]=s.useState(""),[c,p]=s.useState(!1);s.useEffect(()=>{fetch("/api/waitlist/check-access",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}).then(a=>a.json()).then(a=>{N(a),h(!1)}).catch(()=>h(!1))},[]);const i=t?.referralCode?`${window.location.origin}/register?ref=${t.referralCode}`:"",f=async()=>{i&&(await navigator.clipboard.writeText(i),x(!0),setTimeout(()=>x(!1),2e3))},C=async()=>{i&&(navigator.share?await navigator.share({title:"Join FairStack",text:"Get early access to FairStack. Fair pricing for AI generation.",url:i}).catch(()=>{}):f())},S=async a=>{if(a.preventDefault(),!(!l||c)){p(!0),o("");try{const g=await(await fetch("/api/invite/redeem",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({code:l})})).json();g.success?window.location.href="/app/home":o(g.error||"Invalid code")}catch{o("Network error. Try again.")}finally{p(!1)}}};if(k)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(b,{className:"h-6 w-6 animate-spin text-muted-foreground"})});const T=t&&t.totalWaiting>0?Math.max(5,Math.round((t.totalWaiting-t.position+1)/t.totalWaiting*100)):50;return e.jsxs("div",{className:"min-h-screen bg-background relative overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsx("div",{className:"absolute top-0 right-1/3 w-[700px] h-[500px] bg-violet-600/8 rounded-full blur-[140px]"}),e.jsx("div",{className:"absolute bottom-0 left-1/4 w-[500px] h-[400px] bg-brand/6 rounded-full blur-[120px]"})]}),e.jsx("div",{className:"mx-auto w-full max-w-md px-5 sm:px-6 relative z-10",children:e.jsx("div",{className:"flex min-h-screen flex-col justify-center py-12",children:e.jsxs(r.div,{initial:"hidden",animate:"show",transition:{staggerChildren:.08},className:"grid gap-6",children:[e.jsx(r.div,{variants:n,className:"text-center",children:e.jsxs(j,{href:"/",className:"inline-flex items-center gap-3",children:[e.jsx("img",{src:"/assets/logo/FairStackIcon.png",alt:"",className:"h-16 w-16 invert"}),e.jsx("span",{className:"font-serif text-3xl tracking-tight text-white",children:"FairStack"})]})}),e.jsx(r.div,{variants:n,children:e.jsxs("div",{className:"rounded-2xl p-8 bg-background/60 border border-white/10 backdrop-blur-md text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your position"}),e.jsxs("div",{className:"text-6xl font-bold text-white mb-1",children:["#",t?.position||"?"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["of ",t?.totalWaiting||0," waiting"]}),e.jsx("div",{className:"mt-6 h-2 bg-card rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-violet-500 to-brand rounded-full transition-all duration-slowest",style:{width:`${T}%`}})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:t?.position===1?"You're next!":"Share to move up the queue"})]})}),e.jsx(r.div,{variants:n,children:e.jsxs("div",{className:"rounded-2xl p-6 bg-background/40 border border-white/5 backdrop-blur-md",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(R,{className:"h-4 w-4 text-brand"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Referrals"}),t&&t.referralCount>0&&e.jsxs("span",{className:"ml-auto flex items-center gap-1 text-sm text-brand",children:[e.jsx(U,{className:"h-3 w-3"}),t.referralCount," ",t.referralCount===1?"referral":"referrals"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Each friend who joins moves you up the queue."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{readOnly:!0,value:i,"aria-label":"Referral link",className:"flex-1 bg-card/50 border-white/10 text-white text-sm font-mono",onClick:a=>a.target.select()}),e.jsx(d,{variant:"outline",size:"icon",className:"shrink-0 border-white/10 text-white hover:bg-white/10",onClick:f,"aria-label":m?"Copied":"Copy referral link",children:m?e.jsx(E,{className:"h-4 w-4 text-brand"}):e.jsx(F,{className:"h-4 w-4"})}),e.jsx(d,{variant:"outline",size:"icon",className:"shrink-0 border-white/10 text-white hover:bg-white/10",onClick:C,"aria-label":"Share referral link",children:e.jsx(I,{className:"h-4 w-4"})})]})]})}),e.jsx(r.div,{variants:n,children:e.jsxs("div",{className:"rounded-2xl p-6 bg-background/40 border border-white/5 backdrop-blur-md",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(W,{className:"h-4 w-4 text-violet-400"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Have an invite code?"})]}),e.jsxs("form",{onSubmit:S,className:"flex gap-2",children:[e.jsx(v,{type:"text",placeholder:"FS-XXXXXXXX",value:l,onCh
1ange:a=>{y(a.target.value.toUpperCase()),o("")},className:"flex-1 bg-card/50 border-white/10 text-white placeholder:text-muted-foreground font-mono tracking-wider uppercase"}),e.jsx(d,{type:"submit",disabled:!l||c,className:"shrink-0 bg-white text-black dark:text-white hover:bg-white/90",children:c?e.jsx(b,{className:"h-4 w-4 animate-spin"}):"Redeem"})]}),u&&e.jsx("p",{className:"text-sm text-destructive mt-2",children:u})]})}),e.jsx(r.div,{variants:n,className:"text-center text-sm text-muted-foreground",children:e.jsxs("p",{children:["Signed in as ",w?.email||"..."," ",e.jsx("span",{className:"mx-1",children:"|"}),e.jsx(j,{href:"/",className:"text-white underline decoration-white/30 hover:decoration-white",children:"Back to homepage"})]})})]})})})]})}export{B 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.