1import{A as d,k as u,r as i,u as y,j as e,U as j,V as N,X as E,q as S,Y as A,Z as I,p as k,F as T,M}from"../index.js";const x={checkInvite:async s=>await fetch(`${d}/invite/${s}`,{method:"GET"}).then(t=>t.json()).catch(t=>(console.error(t),{invite:null,error:t.message})),acceptInvite:async(s,t={})=>await fetch(`${d}/invite/${s}`,{method:"POST",body:JSON.stringify(t)}).then(r=>r.json()).catch(r=>(console.error(r),{success:!1,error:r.message}))};function U(){const{code:s}=u(),[t,r]=i.useState(null),{t:n}=y(),o=async a=>{r(null),a.preventDefault();const l={},h=new FormData(a.target);for(var[p,f]of h.entries())l[p]=f;const{success:b,error:g}=await x.acceptInvite(s,l);if(b){const{valid:v,user:c,token:m,message:w}=await S.requestToken(l);v&&m&&c?(window.localStorage.setItem(A,JSON.stringify(c)),window.localStorage.setItem(I,m),window.location=k.home()):r(w);return}r(g)};return e.jsx("div",{className:"relative w-full max-w-2xl max-h-full",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsx("div",{className:"flex items-start justify-between p-4 border-b rounded-t border-theme-modal-border",children:e.jsx("h3",{className:"text-xl font-semibold text-theme-text-primary",children:"Create a new account"})}),e.jsxs("form",{onSubmit:o,children:[e.jsx("div",{className:"p-6 space-y-6 flex h-full w-full",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-theme-text-primary",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"My username",minLength:j,maxLength:N,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-theme-text-secondary",children:n("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-theme-text-primary",children:"Password"}),e.jsx("input",{name:"password",type:"password",className:"border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"Your password",required:!0,minLength:8,autoComplete:"off"})]}),t&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",t]}),e.jsx("p",{className:"text-theme-text-secondary text-xs md:text-sm",children:"After creating your account you will be able to login with these credentials and start using workspaces."})]})}),e.jsx("div",{className:"flex w-full justify-between items-center p-6 space-x-2 border-t rounded-b border-theme-modal-border",children:e.jsx("button",{type:"submit",className:"w-full transition-all duration-300 border border-theme-text-primary px-4 py-2 rounded-lg text-theme-text-primary text-sm items-center flex gap-x-2 hover:bg-theme-text-primary hover:text-theme-bg-primary focus:ring-gray-800 text-center justify-center",children:"Accept Invitation"})})]})]})})}function R(){const{code:s}=u(),[t,r]=i.useState({status:"loading",message:null});return i.useEffect(()=>{async function n(){if(!s){r({status:"invalid",message:"No invite code provided."});return}const{invite:o,error:a}=await x.checkInvite(s);r({status:o?"valid":"invalid",message:a})}n()},[]),t.status==="loading"?e.jsx("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:e.jsx(T,{})}):t.status==="invalid"?e.jsx("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex items-center justify-center",children:e.jsx("p",{className:"text-red-400 text-lg",children:t.message})}):e.jsx("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex items-center justify-center",children:e.jsx(M,{isOpen:!0,children:e.jsx(U,{})})})}export{R 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.