1import{g as b,e as g,r,a as h,j as e}from"./index-t7kuwhQ1.js";import{u as j,B as N}from"./BrandMark-Y_A3GUtv.js";import{P as w}from"./PhoneInput-aTHP9f_4.js";function S(){j();const{token:i}=b(),f=g(),[o,p]=r.useState(!0),[c,x]=r.useState(null),[m,l]=r.useState(""),[d,u]=r.useState(!1),[s,n]=r.useState({first_name:"",last_name:"",phone:"",password:"",confirm:""});r.useEffect(()=>{h.get(`/invites/${i}`).then(a=>{x(a.data),n(t=>({...t,first_name:a.data.first_name||"",last_name:a.data.last_name||""}))}).catch(a=>l(a.response?.data?.error||"Could not load invite")).finally(()=>p(!1))},[i]);async function v(a){if(a.preventDefault(),l(""),s.password.length<12)return l("Password must be at least 12 characters");if(s.password!==s.confirm)return l("Passwords do not match");u(!0);try{const{data:t}=await h.post(`/invites/${i}/accept`,{password:s.password,first_name:s.first_name||void 0,last_name:s.last_name||void 0,phone:s.phone||void 0});localStorage.setItem("lc_token",t.token),localStorage.setItem("lc_user",JSON.stringify(t.user)),location.href="/dashboard"}catch(t){l(t.response?.data?.error||t.message)}finally{u(!1)}}return e.jsx("div",{className:"d-flex align-items-center justify-content-center",style:{minHeight:"100vh",background:"linear-gradient(135deg, var(--brand-dark, #071527) 0%, var(--brand, #0A1F3D) 55%, var(--secondary, #C9A227) 100%)"},children:e.jsx("div",{className:"card shadow-lg",style:{width:480,maxWidth:"94vw"},children:e.jsxs("div",{className:"card-body p-4",children:[e.jsxs("div",{className:"d-flex flex-column align-items-center mb-4",children:[e.jsx(N,{size:"lg"}),e.jsx("p",{className:"text-muted mb-0 mt-2 fs-3",children:"Accept your invitation"})]}),o&&e.jsx("div",{className:"text-center py-4 text-muted",children:"Loading inviteâ¦"}),!o&&!c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"alert alert-danger",children:m||"This invite is invalid or expired."}),e.jsx("button",{className:"btn btn-light w-100",onClick:()=>f("/login"),children:"Go to sign in"})]}),!o&&c&&e.jsxs("form",{onSubmit:v,children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label fw-semibold",children:"Email"}),e.jsx("input",{className:"form-control",value:c.email,disabled:!0})]}),e.jsxs("div",{className:"row g-2 mb-3",children:[e.jsxs("div",{className:"col-6",children:[e.jsx("label",{className:"form-label fw-semibold",children:"First name"}),e.jsx("input",{className:"form-control",value:s.first_name,onChange:a=>n({...s,first_name:a.target.value})})]}),e.jsxs("div",{className:"col-6",children:[e.jsx("label",{className:"form-label fw-semibold",children:"Last name"}),e.jsx("input",{className:"form-control",value:s.last_name,onChange:a=>n({...s,last_name:a.target.value})})]})]}),e.jsxs("div",{className:"mb-3",children:[e.jsxs("label",{className:"form-label fw-semibold",children:["Phone ",e.jsx("span",{className:"text-muted",children:"(optional)"})]}),e.jsx(w,{value:s.phone,onChange:a=>n({...s,phone:a})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label fw-semibold",children:"Password"}),e.jsx("input",{type:"password",className:"form-control",value:s.password,onChange:a=>n({...s,password:a.target.value}),required:!0,minLength:12})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label fw-semibold",children:"Confirm password"}),e.jsx("input",{type:"password",className:"form-control",value:s.confirm,onChange:a=>n({...s,confirm:a.target.value}),required:!0,minLength:12})]}),m&&e.jsx("div",{className:"alert alert-danger py-2 mb-3",children:m}),e.jsx("button",{type:"submit",className:"btn btn-primary w-100",disabled:d,children:d?"Creating accountâ¦":"Create account & sign in"})]})]})})})}export{S 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.