1import{j as e}from"./vendor-query-HJumQY92.js";import{f as N,r as u,L as v}from"./vendor-react-CtGcEs0k.js";import{u as _,a as S,H as k,ay as C,e as b,l as j,A as w,B as A,o as P,b as G,s as c,D as I,n as O}from"./index-Cuw8tnyl.js";import{A as E}from"./AlreadySignedInGuard-ZtsSgSmk.js";import{P as B}from"./palette-4BYhtbHv.js";import"./vendor-supabase-B7Px3hk-.js";const m=[{id:"client",title:"I'm a client",tagline:"Discover and book trusted beauty professionals.",bullets:["Browse verified artists","Book appointments in seconds","Build your beauty profile"],icon:G,cta:"Continue as client",destination:()=>"/signup?role=client&ref=get-started"},{id:"artist",title:"I'm a beauty professional",tagline:"Run your business with bookings, clients & payments in one place.",bullets:["Manage bookings & calendar","Get discovered in the directory","Accept secure payments"],icon:B,cta:"Continue as professional",destination:()=>"/signup?role=artist&ref=get-started"}],R=()=>{var y;const[x]=N(),r=x.get("role"),n=x.get("oauth")==="true",{user:o}=_(),[l,h]=u.useState(r&&m.some(t=>t.id===r)?r:null),[p,f]=u.useState(!1);u.useEffect(()=>{r&&m.some(t=>t.id===r)&&h(r)},[r]);const g=async t=>{if(o){f(!0);try{if(t==="client")try{const{data:s}=await c.from("profiles").select("id").eq("user_id",o.id).maybeSingle(),{data:a}=await c.from("client_profiles").select("id").eq("user_id",o.id).maybeSingle();s&&!a&&(await c.auth.updateUser({data:{user_type:"client"}}),await c.rpc("fix_oauth_misrouted_user",{_user_id:o.id}))}catch(s){console.error("[GetStarted] misroute repair failed:",s)}try{await c.rpc("add_role_to_account",{_role:t}),await c.rpc("set_active_role",{_role:t})}catch(s){console.error("[GetStarted] add_role_to_account failed:",s)}const i=t==="client"?"/client/dashboard":"/dashboard",d=t==="client"?"clients":"artists";window.location.assign(I(d,`${i}?tour=start`))}catch(i){console.error("[GetStarted] OAuth role completion error:",i),O.error("Could not set up your account. Please try again."),f(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsx(S,{title:"Create your agendaat account",canonicalPath:"/get-started",description:"Choose how you'd like to use agendaat â as a client or a beauty professional."}),e.jsx(k,{}),e.jsx("main",{className:"min-h-screen bg-background pt-24 pb-16 px-4",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10 md:mb-14",children:[e.jsx("h1",{className:"font-serif text-4xl md:text-5xl text-foreground mb-3",children:"Create your account"}),e.jsx("p",{className:"text-muted-foreground text-base md:text-lg max-w-xl mx-auto",children:"Tell us how you'd like to use agendaat. You can always add another role later."})]}),e.jsx("div",{className:"grid md:grid-cols-2 gap-4 md:gap-6",children:m.map(t=>{const i=t.icon,d=l===t.id,s=()=>{h(t.id),n&&o?g(t.id):n||window.location.assign(t.destination())};return e.jsxs(C,{role:"button",tabIndex:0,onClick:s,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),s())},className:b("group cursor-pointer p-6 md:p-7 rounded-3xl border-2 transition-all duration-200","hover:border-primary/50 hover:shadow-lg",d?"border-primary shadow-lg bg-primary/5":"border-border bg-card"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("div",{className:b("w-12 h-12 rounded-2xl flex items-center justify-center transition-colors",d?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),children:e.jsx(i,{className:"w-6 h-6"})}),d&&e.jsx("div",{className:"w-6 h-6 rounded-full bg-primary text-primary-foreground flex items-center justify-center",children:e.jsx(j,{className:"w-3.5 h-3.5"})})]}),e.jsx("h2",{className:"font-serif text-2xl text-foreground mb-2",children:t.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t.tagline}),e.jsx("ul",{className:"space-y-1.5 text-sm text-foreground/80",children:t.bullets.map(a=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(j,{className:"w-4 h-4 text-primary mt-0.5 shrink-0"}),e.jsx("span",{children:a})]},a))}),!n&&e.jsxs("div",{className:"mt-5 flex items-center gap-1.5 text-sm font-medium text-primary",children:[t.cta,e.jsx(w,{className:"w-4 h-4"})]})]},t.id)})}),e.jsxs("div",{className:"mt-10 flex flex-col items-center gap-4",children:[n&&e.jsx("p",{className:"text-sm text-muted-foreground -mt-4 text-center max-w-md",children:"You're almost in. Pick the role that fits and we'll set up your account."}),e.jsx(A,{size:"lg",disabled:!l||p,className:"min-w-[260px] rounded-full",onClick:()=>{const t=m.find(i=>i.id===l);
1t&&(n&&o?g(t.id):window.location.assign(t.destination()))},children:p?e.jsx(P,{className:"w-4 h-4 animate-spin"}):e.jsxs(e.Fragment,{children:[l?(y=m.find(t=>t.id===l))==null?void 0:y.cta:"Choose an option to continue",l&&e.jsx(w,{className:"w-4 h-4 ml-2"})]})}),!n&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Already have an account?"," ",e.jsx(v,{to:"/sign-in",className:"text-primary font-medium hover:underline",children:"Sign in"})]})]})]})})]})},U=()=>e.jsx(E,{children:e.jsx(R,{})});export{U 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.