1import{b as v,x as k,w as E,h as L,r as x,j as e,f as u,L as i,B as c,g as C}from"./index-D0-3ZSR9.js";import{u as A}from"./useQuery-BbE48q-o.js";import{u as T}from"./useMutation-Dc4YVqjV.js";import{C as h}from"./circle-x-BILBKKei.js";import{C as b}from"./circle-check-CQIvkkkC.js";import{U as I}from"./users-BvhMkhhL.js";import"./utils-km2FGkQ4.js";const S=v("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);async function p(l,t,g){const d=C(),a=await fetch(t,{method:l,headers:{"Content-Type":"application/json",...d?{Authorization:`Bearer ${d}`}:{}},body:void 0}),n=await a.json().catch(()=>({}));if(!a.ok)throw new Error(n.error??"Request failed");return n}function B(){const t=k().token??"",[,g]=E(),a=!!L(),[n,f]=x.useState(!1),[m,j]=x.useState(null),{data:s,isLoading:y,error:N}=A({queryKey:["/api/team/invite-info",t],queryFn:()=>p("GET",`/api/team/invite-info/${t}`),enabled:!!t,retry:!1}),w=T({mutationFn:()=>p("POST",`/api/team/accept/${t}`),onSuccess:()=>{f(!0),setTimeout(()=>g("/dashboard"),2500)},onError:o=>{j(o.message)}});return x.useEffect(()=>{t&&localStorage.setItem("ra_team_token",t)},[t]),x.useEffect(()=>{a&&s&&s.status==="pending"&&!n&&!m&&w.mutate()},[a,s]),y?e.jsxs(r,{children:[e.jsx(u,{className:"w-8 h-8 animate-spin text-amber-400"}),e.jsx("p",{className:"text-gray-400 mt-3 text-sm",children:"Loading invitationâ¦"})]}):N||!s?e.jsxs(r,{children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-red-500/10 border border-red-500/20 flex items-center justify-center mb-4",children:e.jsx(h,{className:"w-7 h-7 text-red-400"})}),e.jsx("h2",{className:"text-lg font-bold text-white mb-2",children:"Invite not found"}),e.jsx("p",{className:"text-sm text-gray-400 mb-6",children:"This invitation link may have expired or already been used."}),e.jsx(i,{href:"/",children:e.jsx(c,{variant:"outline",className:"border-gray-700 text-gray-300",children:"Go to homepage"})})]}):s.status!=="pending"?e.jsxs(r,{children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gray-800 border border-gray-700 flex items-center justify-center mb-4",children:e.jsx(h,{className:"w-7 h-7 text-gray-500"})}),e.jsx("h2",{className:"text-lg font-bold text-white mb-2",children:"Invitation unavailable"}),e.jsxs("p",{className:"text-sm text-gray-400 mb-6",children:["This invitation has already been ",s.status==="active"?"accepted":"revoked","."]}),e.jsx(i,{href:"/dashboard",children:e.jsx(c,{className:"bg-purple-600 hover:bg-purple-500 text-white",children:"Go to dashboard"})})]}):n?e.jsxs(r,{children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-green-500/10 border border-green-500/20 flex items-center justify-center mb-4",children:e.jsx(b,{className:"w-7 h-7 text-green-400"})}),e.jsx("h2",{className:"text-lg font-bold text-white mb-2",children:"You're in!"}),e.jsxs("p",{className:"text-sm text-gray-400 mb-1",children:["Welcome to ",e.jsxs("strong",{className:"text-white",children:[s.inviterName,"'s"]})," team."]}),e.jsx("p",{className:"text-xs text-gray-500",children:"Redirecting to your dashboardâ¦"})]}):m?e.jsxs(r,{children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-red-500/10 border border-red-500/20 flex items-center justify-center mb-4",children:e.jsx(h,{className:"w-7 h-7 text-red-400"})}),e.jsx("h2",{className:"text-lg font-bold text-white mb-2",children:"Could not accept invite"}),e.jsx("p",{className:"text-sm text-red-400 mb-6",children:m}),e.jsx(i,{href:"/dashboard",children:e.jsx(c,{variant:"outline",className:"border-gray-700 text-gray-300",children:"Go to dashboard"})})]}):e.jsxs(r,{children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-amber-500/10 border border-amber-500/25 flex items-center justify-center mb-5",children:e.jsx(I,{className:"w-7 h-7 text-amber-400"})}),e.jsx("h2",{className:"text-xl font-bold text-white mb-2",children:"Team invitation"}),e.jsxs("p",{className:"text-sm text-gray-400 mb-1",children:[e.jsx("strong",{className:"text-amber-400",children:s.inviterName})," has invited you to join their Elite workspace."]}),e.jsxs("p",{className:"text-xs text-gray-500 mb-8",children:["Sent to ",e.jsx("span",{className:"text-gray-300",children:s.memberEmail})]}),e.jsxs("div",{className:"w-full max-w-xs bg-gray-900 border border-gray-800 rounded-xl p-4 mb-6 text-left",children:[e.jsx("p",{className:"text-xs font-semibold text-amber-400 uppercase tracking-wider mb-3",children:"What you'll get"}),["All frontier AI models","Unlimited agents & vault","Multi-Agent Collaboration","Marketplace & earnings"].map(o=>e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(b,{className:"w-3.5 h-3.5 text-green-400 shrink-0"}),e.jsx("span",{className:"text-xs text-gray-300",children:o})]},o))]}),a?e.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm",children:[e.jsx(u,{className:"w-4 h-4 animate-spin"}),"Accepting your invitationâ¦"]}):e.jsxs("div",{className:"flex flex-col gap-3 w-full max-w-xs",children:[e.jsx(i,{href:`/login?redirect=/team/accept/${t}`,children:e.jsxs(c,{className:"w-full bg-amber-600 hover:bg-amber-500 text-white gap-2",children:[e.jsx(S,{className:"w-4 h-4"})," Log in to accept"]})}),e.jsx(i,{href:`/register?redirect=/team/accept/${t}`,children:e.jsx(c,{variant:"outline",className:"w-full border-gray-700 text-gray-300 hover:text-white",children:"Create an account"})}),e.jsxs("p",{className:"text-xs text-gray-600 text-center",children:["You must log in with ",e.jsx("span",{className:"text-gray-400",children:s.memberEmail})]})]})]})}function r({children:l}){return e.jsxs("div",{className:"min-h-screen bg-gray-950 flex flex-col items-center justify-center px-4",children:[e.jsx("div",{className:"mb-8 text-center",children:e.jsx("span",{className:"text-2xl font-extrabold text-white",children:"â¡ Rare Agents"})}),e.jsx("div",{className:"w-full max-w-sm bg-gray-900 border border-gray-800 rounded-2xl p-8 flex flex-col items-center text-center",children:l})]})}
1export{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.