1import{r as n,U as w,ae as _,a2 as r,q as e,al as l,a9 as o,Q as d,B as m,am as S,s as k,t as C,v as U,x as P,F as L,w as x,N as B,M as H,O as z}from"./index-RQZfdGSV.js";import{P as A}from"./PreferencesChat-CHYBO2-o.js";import{A as D}from"./arrow-left-B0jdwYg2.js";import{S as E}from"./settings-Cl1wpAwS.js";import{L as O}from"./log-out-BWqDzzvS.js";import"./alert-dialog-BmdSQsbw.js";import"./message-circle-BD1mtwUz.js";import"./circle-check-CQuexJnh.js";import"./send-DUJfWrBL.js";import"./save-iRHaixmg.js";import"./pencil-DZwwnk3k.js";function K(){var h;const[c,f]=n.useState(null),[s,g]=n.useState(null),[j,N]=n.useState(!0),{toast:u}=w(),t=_();n.useEffect(()=>{v()},[]);const v=async()=>{const{data:{user:a}}=await r.auth.getUser();if(!a){t("/auth");return}f(a);const{data:i}=await r.from("profiles").select("*").eq("id",a.id).single();g(i),N(!1)},y=async()=>{await r.auth.signOut(),t("/")},b=async()=>{try{const{data:{user:a}}=await r.auth.getUser();if(!a){t("/auth");return}const{error:i}=await r.from("profiles").update({onboarding_completed:!0}).eq("id",a.id);if(i)throw i;u({title:"Welcome to HomeLens!",description:"Your preferences have been saved."}),t("/")}catch(a){u({title:"Error",description:a.message,variant:"destructive"})}},p=a=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(a);return j?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(l,{}),e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsx(o,{className:"h-16 w-64 mb-8"}),e.jsx(o,{className:"h-48 w-full mb-8"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(3)].map((a,i)=>e.jsx(o,{className:"h-64"},i))})]})]}):s&&!s.onboarding_completed?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(l,{}),e.jsxs("div",{className:"container mx-auto px-4 py-8 pb-24 max-w-5xl",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("div",{className:"flex items-center justify-center mb-4",children:e.jsx(d,{className:"h-12 w-12 text-primary"})}),e.jsx("h1",{className:"text-4xl font-bold mb-2",children:"Set Up Your Profile"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Have a personalized experience with HomeLens."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"All fields are optional â you can always update them later."})]}),e.jsx(A,{onSaveComplete:b,continueLabel:"Save and continue",onSkip:async()=>{const{data:{user:a}}=await r.auth.getUser();a&&await r.from("profiles").update({onboarding_completed:!0}).eq("id",a.id),t("/")}})]})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(l,{}),e.jsx("div",{className:"container mx-auto px-4 pt-20",children:e.jsxs(m,{variant:"ghost",onClick:()=>t("/"),className:"mb-4",children:[e.jsx(D,{className:"h-4 w-4 mr-2"}),"Back to Home"]})}),e.jsx("div",{className:"container mx-auto px-4 pb-24 lg:pb-12",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(S,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl font-bold mb-2",children:"My Profile"}),e.jsx("p",{className:"text-muted-foreground",children:c==null?void 0:c.email})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(m,{variant:"outline",onClick:()=>t("/profile-setup"),children:[e.jsx(E,{className:"mr-2 h-4 w-4"}),"Edit Preferences"]}),e.jsxs(m,{variant:"outline",onClick:y,children:[e.jsx(O,{className:"mr-2 h-4 w-4"}),"Sign Out"]})]})]}),s&&s.onboarding_completed&&e.jsxs(k,{className:"mb-8",children:[e.jsxs(C,{children:[e.jsx(U,{children:"Your Preferences"}),e.jsx(P,{children:"We use these to personalize your search results"})]}),e.jsx(L,{children:e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[e.jsx(d,{className:"h-4 w-4"}),"Buyer Type"]}),e.jsx(x,{variant:"secondary",className:"capitalize",children:(h=s.buyer_t
1ype)==null?void 0:h.replace("-"," ")})]}),s.budget_min&&s.budget_max&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[e.jsx(B,{className:"h-4 w-4"}),"Budget Range"]}),e.jsxs("div",{className:"text-sm font-medium",children:[p(s.budget_min)," - ",p(s.budget_max)]})]}),s.property_types&&s.property_types.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[e.jsx(d,{className:"h-4 w-4"}),"Property Types"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.property_types.map(a=>e.jsx(x,{variant:"outline",className:"text-xs capitalize",children:a},a))})]}),s.location_preferences&&s.location_preferences.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[e.jsx(H,{className:"h-4 w-4"}),"Locations"]}),e.jsx("div",{className:"text-sm",children:s.location_preferences.join(", ")})]}),s.risk_level&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[e.jsx(z,{className:"h-4 w-4"}),"Risk Level"]}),e.jsx(x,{variant:"secondary",className:"capitalize",children:s.risk_level})]})]})})]})]})})]})}export{K 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.