1import{d as C,r as u,j as e}from"./vendor-DG7D-edB.js";import{a as k,n as S,b as m,o as P,a7 as T,a8 as q,a9 as E,aa as $,ab as F,v as x,J as L,B as h,aT as B,an as O,av as U,bi as W,aW as z,b$ as D,c0 as H,bF as K}from"./index-BNWGGHY7.js";import{U as M}from"./utensils-BH27Oyw6.js";import{P as Q}from"./party-popper-sPfDVTPk.js";import"./ui-BYpPUPUG.js";const G={"live-music":e.jsx(K,{className:"w-5 h-5"}),nightlife:e.jsx(Q,{className:"w-5 h-5"}),"arts-culture":e.jsx(H,{className:"w-5 h-5"}),"food-drink":e.jsx(M,{className:"w-5 h-5"}),wellness:e.jsx(D,{className:"w-5 h-5"}),markets:e.jsx(z,{className:"w-5 h-5"}),"career-fairs":e.jsx(W,{className:"w-5 h-5"}),"civic-events":e.jsx(U,{className:"w-5 h-5"}),volunteering:e.jsx(O,{className:"w-5 h-5"}),"kids-activities":e.jsx(x,{className:"w-5 h-5"}),"school-events":e.jsx(B,{className:"w-5 h-5"})};function V(){const[,i]=C(),{toast:l}=k(),p=S(),[r,d]=u.useState([]),{data:n,isLoading:g}=m({queryKey:["/api/auth/me"],queryFn:async()=>(await fetch("/api/auth/me")).json()}),{data:j,isLoading:f}=m({queryKey:["/api/categories"],queryFn:async()=>(await fetch("/api/categories")).json()});u.useEffect(()=>{n?.user?.interestCategories&&d(n.user.interestCategories)},[n?.user?.interestCategories]);const o=P({mutationFn:async s=>{const a=await fetch("/api/user/interests",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({categoryIds:s})});if(!a.ok){const t=await a.json();throw new Error(t.message||"Failed to save interests")}return a.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["/api/auth/me"]}),l({title:"Preferences saved!",description:"We'll personalize your experience based on your interests."}),i("/")},onError:s=>{l({title:"Error",description:s.message,variant:"destructive"})}}),b=s=>{d(a=>a.includes(s)?a.filter(t=>t!==s):[...a,s])},y=()=>{o.mutate(r)},v=()=>{i("/")};if(g||f)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})});if(!n?.user)return i("/login"),null;const N=j?.reduce((s,a)=>{const t=a.parentGroup||"Other";return s[t]||(s[t]=[]),s[t].push(a),s},{})||{};return e.jsx("div",{className:"min-h-screen py-12 px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h1",{className:"text-4xl font-display font-bold mb-3",children:"Welcome!"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Help us personalize your experience by selecting the types of events you're most interested in."})]}),e.jsxs(T,{className:"mb-8",children:[e.jsxs(q,{children:[e.jsx(E,{children:"What interests you?"}),e.jsx($,{children:"Select categories to get personalized event recommendations and newsletters"})]}),e.jsx(F,{children:e.jsx("div",{className:"space-y-6",children:Object.entries(N).map(([s,a])=>e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-sm text-muted-foreground mb-3",children:s}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:a.map(t=>{const c=r.includes(t.id),w=G[t.slug]||e.jsx(x,{className:"w-5 h-5"});return e.jsxs("button",{onClick:()=>b(t.id),className:`flex items-center gap-3 p-3 rounded-lg border-2 transition-all text-left ${c?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,"data-testid":`category-${t.slug}`,children:[e.jsx("div",{className:`p-2 rounded-lg ${c?"bg-primary text-white":"bg-muted"}`,children:w}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"font-medium text-sm truncate",children:t.name})}),e.jsx(L,{checked:c,className:"pointer-events-none"})]},t.id)})})]},s))})})]}),e.jsxs("div",{className:"flex gap-4 justify-center",children:[e.jsx(h,{variant:"outline",onClick:v,"data-testid":"button-skip-onboarding",children:"Skip for now"}),e.jsx(h,{onClick:y,disabled:o.isPending,"data-testid":"button-save-interests",children:o.isPending?"Saving...":`Continue${r.length>0?` (${r.length} selected)`:""}`})]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground mt-6",children:"You can always update your preferences in your profile settings"})]})})}export{V 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.