import{p as b,r as o,j as e,f as d,a2 as g}from"./vendor-DyCecx-5.js";import{a as w,u as j}from"./index-DJXN7D4i.js";const S=()=>{const m=b(),{showToast:u}=j(),[s,x]=o.useState({name:"",email:"",phone:"",password:"",confirmPassword:""}),[h,N]=o.useState(!1),[p,v]=o.useState(!1),[n,c]=o.useState(!1),[i,t]=o.useState(""),a=l=>{x({...s,[l.target.name]:l.target.value}),t("")},f=async l=>{if(l.preventDefault(),s.password!==s.confirmPassword){t("Passwords do not match");return}c(!0),t("");try{const r=await w.signup({name:s.name,email:s.email,phone:s.phone,password:s.password});r.success?(u("Account created successfully! Please sign in.","success"),m("/signin")):t(r.message||"Failed to create account")}catch(r){t(r.message||"Something went wrong. Please try again.")}finally{c(!1)}};return e.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center p-4",children:e.jsx("div",{className:"max-w-md w-full bg-white rounded-lg shadow-sm border border-slate-100 overflow-hidden",children:e.jsxs("div",{className:"p-8",children:[e.jsx("div",{className:"mb-4",children:e.jsxs(d,{to:"/",className:"inline-flex items-center gap-2 text-xs font-black uppercase tracking-widest text-slate-400 hover:text-slate-900 transition-colors",children:[e.jsx(g,{className:"w-3 h-3 rotate-180"}),"Back to Home"]})}),e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Create Account"}),e.jsx("p",{className:"text-slate-500 text-sm",children:"Join us to start booking hotels"})]}),i&&e.jsx("div",{className:"mb-6 p-3 bg-rose-50 border border-rose-100 rounded text-rose-600 text-xs font-bold",children:i}),e.jsxs("form",{onSubmit:f,className:"space-y-4 text-left",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-sm font-bold text-slate-700",children:"Full Name"}),e.jsx("input",{type:"text",name:"name",value:s.name,onChange:a,required:!0,className:"w-full px-4 py-2 border border-slate-200 rounded text-sm focus:outline-none focus:ring-1 focus:ring-slate-900",placeholder:"John Doe"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-sm font-bold text-slate-700",children:"Email Address"}),e.jsx("input",{type:"email",name:"email",value:s.email,onChange:a,required:!0,className:"w-full px-4 py-2 border border-slate-200 rounded text-sm focus:outline-none focus:ring-1 focus:ring-slate-900",placeholder:"john@example.com"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-sm font-bold text-slate-700",children:"Phone Number"}),e.jsx("input",{type:"tel",name:"phone",value:s.phone,onChange:a,className:"w-full px-4 py-2 border border-slate-200 rounded text-sm focus:outline-none focus:ring-1 focus:ring-slate-900",placeholder:"+1 234 567 8900"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-sm font-bold text-slate-700",children:"Password"}),e.jsx("input",{type:h?"text":"password",name:"password",value:s.password,onChange:a,required:!0,className:"w-full px-4 py-2 border border-slate-200 rounded text-sm focus:outline-none focus:ring-1 focus:ring-slate-900",placeholder:"••••••••"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-sm font-bold text-slate-700",children:"Confirm"}),e.jsx("input",{type:p?"text":"password",name:"confirmPassword",value:s.confirmPassword,onChange:a,required:!0,className:"w-full px-4 py-2 border border-slate-200 rounded text-sm focus:outline-none focus:ring-1 focus:ring-slate-900",placeholder:"••••••••"})]})]}),e.jsx("button",{type:"submit",disabled:n,className:"w-full py-2.5 bg-slate-900 text-white rounded font-bold hover:bg-slate-800 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 mt-2",children:n?"Creating Account...":"Create Account"})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsxs("p",{className:"text-slate-500 font-medium",children:["Already have an account?"," ",e.jsx(d,{to:"/signin",className:"text-indigo-600 font-bold hover:text-indigo-700",children:"Sign In"})]})})]})})})};export{S as default};
