1import{a as p,j as e}from"./vendor-query-DoGi7Pa9.js";import{r as x}from"./vendor-react--0RGCJ5T.js";import{u as g,b as n,X as y}from"./vendor-misc-C8vAFq1k.js";import{u as f,B as d,C as N,L as r,I as i,k as b,a2 as v}from"./index-j-c6Yr3C.js";import"./vendor-ui-EJdtKGrQ.js";import"./vendor-charts-DXLj6IhK.js";function S(){const[a,c]=x.useState({email:"",password:"",confirmPassword:"",firstName:"",lastName:"",company:"",phone:""}),[,m]=g(),{toast:o}=f(),l=p({mutationFn:async s=>await b("POST","/api/client-portal/register",s),onSuccess:()=>{o({title:"Account created",description:"Welcome to the TNC Client Portal"}),v.invalidateQueries({queryKey:["/api/client-portal/me"]}),m("/client-portal/dashboard")},onError:s=>{o({variant:"destructive",title:"Registration failed",description:s.message||"Failed to create account"})}}),t=s=>{c({...a,[s.target.name]:s.target.value})},u=async s=>{if(s.preventDefault(),!a.email||!a.password||!a.firstName||!a.lastName){o({variant:"destructive",title:"Required fields",description:"Please fill in all required fields"});return}if(a.password.length<8){o({variant:"destructive",title:"Invalid password",description:"Password must be at least 8 characters"});return}if(a.password!==a.confirmPassword){o({variant:"destructive",title:"Passwords don't match",description:"Please make sure your passwords match"});return}const{confirmPassword:w,...h}=a;l.mutate(h)};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 flex items-center justify-center p-4 relative overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 bg-primary/20 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 bg-accent/20 rounded-full blur-3xl"})]}),e.jsx(n,{href:"/",className:"absolute top-8 right-8 z-50",children:e.jsx(d,{variant:"ghost",size:"icon",className:"text-white hover:bg-white/10 rounded-full","data-testid":"button-close-portal",children:e.jsx(y,{className:"w-6 h-6"})})}),e.jsx(N,{className:"w-full max-w-2xl bg-white/95 backdrop-blur-lg shadow-2xl border-0 relative z-10",children:e.jsxs("div",{className:"p-5 sm:p-8 md:p-12 space-y-8",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl md:text-4xl font-bold text-gray-900",children:"Create Your Account"}),e.jsx("p",{className:"text-gray-600 text-lg",children:"Get access to the TNC Client Portal"})]}),e.jsxs("form",{onSubmit:u,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"firstName",className:"text-gray-900 font-medium",children:"First Name *"}),e.jsx(i,{id:"firstName",name:"firstName",type:"text",value:a.firstName,onChange:t,className:"h-12 bg-white border-gray-300 focus:border-primary","data-testid":"input-first-name",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"lastName",className:"text-gray-900 font-medium",children:"Last Name *"}),e.jsx(i,{id:"lastName",name:"lastName",type:"text",value:a.lastName,onChange:t,className:"h-12 bg-white border-gray-300 focus:border-primary","data-testid":"input-last-name",required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"email",className:"text-gray-900 font-medium",children:"Email Address *"}),e.jsx(i,{id:"email",name:"email",type:"email",value:a.email,onChange:t,className:"h-12 bg-white border-gray-300 focus:border-primary",placeholder:"[email protected]","data-testid":"input-email",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"company",className:"text-gray-900 font-medium",children:"Company"}),e.jsx(i,{id:"company",name:"company",type:"text",value:a.company,onChange:t,className:"h-12 bg-white border-gray-300 focus:border-primary","data-testid":"input-company"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"phone",className:"text-gray-900 font-medium",children:"Phone"}
1),e.jsx(i,{id:"phone",name:"phone",type:"tel",value:a.phone,onChange:t,className:"h-12 bg-white border-gray-300 focus:border-primary","data-testid":"input-phone"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"password",className:"text-gray-900 font-medium",children:"Password *"}),e.jsx(i,{id:"password",name:"password",type:"password",value:a.password,onChange:t,className:"h-12 bg-white border-gray-300 focus:border-primary",placeholder:"Minimum 8 characters","data-testid":"input-password",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"confirmPassword",className:"text-gray-900 font-medium",children:"Confirm Password *"}),e.jsx(i,{id:"confirmPassword",name:"confirmPassword",type:"password",value:a.confirmPassword,onChange:t,className:"h-12 bg-white border-gray-300 focus:border-primary","data-testid":"input-confirm-password",required:!0})]})]}),e.jsx(d,{type:"submit",className:"w-full h-12 bg-gray-900 hover:bg-gray-800 text-white font-medium text-base",disabled:l.isPending,"data-testid":"button-register",children:l.isPending?"Creating account...":"Create Account"})]}),e.jsxs("div",{className:"text-center text-sm text-gray-600",children:["Already have an account?"," ",e.jsx(n,{href:"/client-portal/login",children:e.jsx("button",{type:"button",className:"text-primary hover:text-primary/80 font-medium transition-colors","data-testid":"link-login",children:"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.