1import{r as o,j as e,m as c}from"./vendor-motion-9qIbWfdh.js";import{ay as T,c8 as O,cJ as Y,u as G,j as K,K as h,aR as V,a8 as v,aL as E,ax as p,ao as f,dr as I,a7 as w,aa as t,bm as u,av as $,ds as z,dt as k,du as J,ae as S,k as U,N as _}from"./index-RER_5nha.js";import{D as A}from"./drumstick-CPyW_kh1.js";import"./vendor-react-C0Dkio3Y.js";import"./vendor-query-CrasLRbE.js";import"./vendor-charts-JEUKlbbs.js";const L=T("CircleOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]);const q=T("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]),P=[{id:"none",label:"No Specific Diet",description:"No dietary restrictions",icon:V},{id:"keto",label:"Keto",description:"High fat, very low carb",icon:v},{id:"paleo",label:"Paleo",description:"Whole foods, no grains or dairy",icon:A},{id:"vegan",label:"Vegan",description:"No animal products",icon:h},{id:"vegetarian",label:"Vegetarian",description:"No meat or fish",icon:h},{id:"pescatarian",label:"Pescatarian",description:"Fish but no meat",icon:E},{id:"carnivore",label:"Carnivore",description:"Animal products only",icon:A},{id:"mediterranean",label:"Mediterranean",description:"Plant-forward, healthy fats",icon:p},{id:"whole30",label:"Whole30",description:"No sugar, grains, dairy, legumes",icon:L},{id:"calorie-counting",label:"Calorie Counting",description:"Track calories & macros daily",icon:v},{id:"low-carb",label:"Low Carb",description:"Reduced carbohydrate intake",icon:f},{id:"gluten-free",label:"Gluten Free",description:"No wheat, barley, rye",icon:f},{id:"dairy-free",label:"Dairy Free",description:"No milk, cheese, butter",icon:I},{id:"halal",label:"Halal",description:"Islamic dietary guidelines",icon:p},{id:"kosher",label:"Kosher",description:"Jewish dietary guidelines",icon:p}],C=[{id:"gluten",label:"Gluten",icon:f},{id:"dairy",label:"Dairy",icon:I},{id:"eggs",label:"Eggs",icon:z},{id:"nuts",label:"Tree Nuts",icon:k},{id:"peanuts",label:"Peanuts",icon:k},{id:"soy",label:"Soy",icon:J},{id:"shellfish",label:"Shellfish",icon:q},{id:"fish",label:"Fish",icon:E}],D=[{id:"seed-oils",label:"Seed Oils"},{id:"added-sugar",label:"Added Sugar"},{id:"artificial-sweeteners",label:"Artificial Sweeteners"},{id:"processed-foods",label:"Processed Foods"},{id:"high-sodium",label:"High Sodium"},{id:"alcohol",label:"Alcohol"},{id:"caffeine",label:"Caffeine"},{id:"red-meat",label:"Red Meat"},{id:"pork",label:"Pork"}];function ie(){const{data:g,isLoading:F}=O(),m=Y(),{toast:b}=G(),i=g?.dietaryProfile,[l,y]=o.useState("none"),[n,j]=o.useState([]),[r,N]=o.useState([]),[M,x]=o.useState(!1);o.useEffect(()=>{i&&(y(i.dietType||"none"),j(i.allergens||[]),N(i.avoidances||[]))},[i]);function B(a){j(s=>s.includes(a)?s.filter(d=>d!==a):[...s,a]),x(!0)}function H(a){N(s=>s.includes(a)?s.filter(d=>d!==a):[...s,a]),x(!0)}function R(a){y(a),x(!0)}function W(){const s={...g?.dietaryProfile||{},dietType:l,allergens:n,avoidances:r};m.mutate({...g,dietaryProfile:s,isDefault:void 0,id:void 0,userId:void 0,updatedAt:void 0},{onSuccess:()=>{b({title:"Diet preferences saved",description:"Your AI suggestions will now be personalized"}),x(!1)},onError:()=>{b({title:"Failed to save",variant:"destructive"})}})}return F?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx("div",{className:"w-10 h-10 border-4 border-primary border-t-transparent rounded-full animate-spin"})}):e.jsxs("div",{className:"min-h-screen bg-background pb-32",children:[e.jsx("div",{className:"bg-primary/5 border-b border-border",children:e.jsxs("div",{className:"max-w-lg lg:max-w-2xl mx-auto px-6 pb-6",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 8px)"},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(K,{fallback:"/settings","data-testid":"button-back-diet"}),e.jsx("h1",{className:"text-2xl font-display font-bold text-foreground","data-testid":"text-diet-title",children:"Diet & Lifestyle"})]}),e.jsx("p",{className:"text-sm text-muted-foreground ml-11",children:"Tell us about your diet so we can personalize your scan results and suggestions"})]})}),e.jsxs("div",{className:"max-w-lg lg:max-w-2xl mx-auto px-6 py-6 space-y-6",children:[e.jsxs(c.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(h,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"font-bold text-sm text-foreground",children:"Diet Type"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Select the diet that best describes how you eat"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:P.map(a=>{const s=l===a.id,d=a.icon;return e.jsx(w,{className:t("p-3 cursor-pointer transition-all duration-200",s?"ring-2 ring-secondary bg-secondary/5":"hover-elevate"),onClick:()=>R(a.id),"data-testid":`diet-option-${a.id}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:t("p-1 rounded-md flex-shrink-0",s?"bg-secondary/10":"bg-muted"),children:e.jsx(d,{className:t("w-3.5 h-3.5",s?"text-secondary":"text-muted-foreground")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:t("text-sm font-medium truncate",s?"text-secondary":"text-foreground"),children:a.label}),s&&e.jsx(u,{className:"w-3.5 h-3.5 text-secondary flex-shrink-0"})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground leading-tight mt-0.5",children:a.description})]})]})},a.id)})})]}),e.jsxs(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.05},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx($,{className:"w-4 h-4 text-orange-500"}),e.jsx("h3",{className:"font-bold text-sm text-foreground",children:"Allergens"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Select any food allergens so we can flag them in your scans"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(a=>{const s=n.includes(a.id);return e.jsxs(S,{variant:s?"default":"outline",className:t("cursor-pointer px-3 py-1.5 text-xs gap-1.5 toggle-elevate",s&&"toggle-elevated bg-orange-500 border-orange-500 text-white"),onClick:()=>B(a.id),"data-testid":`allergen-${a.id}`,children:[e.jsx(a.icon,{className:"w-3 h-3"}),a.label,s&&e.jsx(u,{className:"w-3 h-3"})]},a.id)})})]}),e.jsxs(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(L,{className:"w-4 h-4 text-red-500"}),e.jsx("h3",{className:"font-bold text-sm text-foreground",children:"Ingredients to Avoid"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"We'll highlight these and suggest alternatives in your results"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(a=>{const s=r.includes(a.id);return e.jsxs(S,{variant:s?"default":"outline",className:t("cursor-pointer px-3 py-1.5 text-xs toggle-elevate",s&&"toggle-elevated bg-red-500 border-red-500 text-white"),onClick:()=>H(a.id),"data-testid":`avoidance-${a.id}`,children:[a.label,s&&e.jsx(u,{className:"w-3 h-3 ml-1"})]},a.id)})})]}),e.jsx(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.15},children:(l!=="none"||n.length>0||r.length>0)&&e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(p,{className:"w-4 h-4 text-primary"}),e.jsx("h4",{className:"font-bold text-sm text-foreground",children:"Your Profile Summary"})]}),e.jsxs("div",{className:"space-y-1.5",children:[l!=="none"&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Diet:"})," ",P.find(a=>a.id===l)?.label]}),n.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Allergens:"})," ",n.map(a=>C.find(s=>s.id===a)?.label).join(", ")]}),r.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Avoiding:"})," ",r.map(a=>D.find(s=>s.id===a)?.label).join(", ")]})]})]})}),e.jsx(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsxs(U,{className:"w-full",onClick:W,disabled:m.isPending||!M&&!!i,"data-testid":"button-save-diet",children:[m.isPending?e.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent roun
1ded-full animate-spin mr-2"}):e.jsx(u,{className:"w-4 h-4 mr-2"}),m.isPending?"Saving...":"Save Preferences"]})}),e.jsx("p",{className:"text-center text-[10px] text-muted-foreground px-4",children:"Your dietary preferences help our AI give you more relevant suggestions, flag potential allergens, and recommend suitable alternatives. This is not medical advice."})]}),e.jsx(_,{})]})}export{ie 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.