1import{j as e}from"./vendor-query-DPZO-Gta.js";import{i as j,u as v,r,L as n}from"./vendor-react-BomFe3BT.js";import{a as b,o as f,z as d,g as N}from"./index-BLzMsaFd.js";import"./vendor-charts-DodUWJ0z.js";function L(){const[m]=j(),s=m.get("token"),x=v(),{isAuthenticated:i}=b(),[t,a]=r.useState("loading"),[h,g]=r.useState("");r.useEffect(()=>{if(!s){a("no_token");return}sessionStorage.setItem("pendingInviteToken",s),i?u():a("login_required")},[s,i]);const u=async()=>{var o,c;a("accepting");try{await f.acceptInvite(s),sessionStorage.removeItem("pendingInviteToken"),d.success("Successfully joined the organization!"),x("/dashboard")}catch(p){a("error");const l=((c=(o=p.response)==null?void 0:o.data)==null?void 0:c.detail)||"Failed to accept invitation";g(l),d.error(l)}};return t==="no_token"?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"max-w-md w-full p-8 bg-white rounded-lg shadow-md text-center",children:[e.jsx("div",{className:"text-red-500 mb-4",children:e.jsx("svg",{className:"w-16 h-16 mx-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Invalid Invitation Link"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"The invitation link appears to be invalid or incomplete."}),e.jsx(n,{to:"/",className:"btn-primary inline-block",children:"Go to Homepage"})]})}):t==="loading"||t==="accepting"?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"max-w-md w-full p-8 bg-white rounded-lg shadow-md text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:t==="accepting"?"Accepting Invitation...":"Loading..."}),e.jsx("p",{className:"text-gray-600",children:"Please wait while we process your invitation."})]})}):t==="error"?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"max-w-md w-full p-8 bg-white rounded-lg shadow-md text-center",children:[e.jsx("div",{className:"text-red-500 mb-4",children:e.jsx("svg",{className:"w-16 h-16 mx-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Invitation Error"}),e.jsx("p",{className:"text-gray-600 mb-6",children:h}),e.jsx(n,{to:"/dashboard",className:"btn-primary inline-block",children:"Go to Dashboard"})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"max-w-md w-full p-8 bg-white rounded-lg shadow-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"text-primary-600 mb-4",children:e.jsx("svg",{className:"w-16 h-16 mx-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"You've Been Invited!"}),e.jsxs("p",{className:"text-gray-600",children:["You've received an invitation to join an organization on ",N().name,". Please sign in or create an account to accept."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(n,{to:"/login",className:"btn-primary w-full block text-center",children:"Sign In to Accept"}),e.jsx(n,{to:"/register",className:"btn-outline w-full block text-center",children:"Create Account"})]}),e.jsx("p",{className:"mt-6 text-center text-sm text-gray-500",children:"After signing in, you'll automatically join the organization."})]})})}export{L 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.