import{c as u,j as e,r as c,B as n,T as i,$ as d,C as m}from"./main-BMMRv56V.js";import{G as s}from"./GroupCard-BWnQWvHn.js";import{G as r}from"./Grid-DyVgKpIU.js";import{T as y,c as b,a as x,b as l}from"./TableRow-BnuF4MgY.js";import{T as p,D as h}from"./TextField-CWEE-Dgp.js";import"./isMuiElement-CEQVLtSO.js";const g=u(e.jsx("path",{d:"M19.8 18.4 14 10.67V6.5l1.35-1.69c.26-.33.03-.81-.39-.81H9.04c-.42 0-.65.48-.39.81L10 6.5v4.17L4.2 18.4c-.49.66-.02 1.6.8 1.6h14c.82 0 1.29-.94.8-1.6"})),j={serving_size:"",calories:0,total_fat:0,saturated_fat:0,trans_fat:0,cholesterol:0,sodium:0,total_carbohydrates:0,dietary_fiber:0,total_sugars:0,added_sugars:0,protein:0,vitamin_d:0,calcium:0,iron:0,potassium:0},o=[{key:"serving_size",label:"Serving Size",unit:"",type:"text"},{key:"calories",label:"Calories",unit:"kcal",type:"number"},{key:"total_fat",label:"Total Fat",unit:"g",type:"number"},{key:"saturated_fat",label:"Saturated Fat",unit:"g",type:"number",indent:!0},{key:"trans_fat",label:"Trans Fat",unit:"g",type:"number",indent:!0},{key:"cholesterol",label:"Cholesterol",unit:"mg",type:"number"},{key:"sodium",label:"Sodium",unit:"mg",type:"number"},{key:"total_carbohydrates",label:"Total Carbohydrates",unit:"g",type:"number"},{key:"dietary_fiber",label:"Dietary Fiber",unit:"g",type:"number",indent:!0},{key:"total_sugars",label:"Total Sugars",unit:"g",type:"number",indent:!0},{key:"added_sugars",label:"Added Sugars",unit:"g",type:"number",indent:!0},{key:"protein",label:"Protein",unit:"g",type:"number"},{key:"vitamin_d",label:"Vitamin D",unit:"mcg",type:"number"},{key:"calcium",label:"Calcium",unit:"mg",type:"number"},{key:"iron",label:"Iron",unit:"mg",type:"number"},{key:"potassium",label:"Potassium",unit:"mg",type:"number"}],S=()=>{const[a]=c.useState(j);return e.jsxs(n,{children:[e.jsx(i,{variant:"h5",sx:{fontWeight:700,fontSize:"20px",mb:2},children:"Nutrition Manager"}),e.jsx(d,{severity:"info",sx:{mb:3},children:"Manage nutrition data for your recipes. You can manually enter values or use the AI to auto-generate nutrition facts from ingredients."}),e.jsxs(r,{container:!0,spacing:3,children:[e.jsx(r,{size:{xs:12,md:7},children:e.jsx(s,{title:"Nutrition Facts Editor",subtitle:"Enter values per serving",action:e.jsx(m,{variant:"outlined",size:"small",startIcon:e.jsx(g,{}),children:"Auto-Calculate"}),children:e.jsx(y,{size:"small",children:e.jsx(b,{children:o.map(t=>e.jsxs(x,{children:[e.jsx(l,{sx:{pl:t.indent?4:2,border:"none",py:.5},children:e.jsx(i,{variant:"body2",sx:{fontWeight:t.indent?400:600},children:t.label})}),e.jsx(l,{sx:{border:"none",py:.5,width:150},children:e.jsx(p,{size:"small",type:t.type,value:a[t.key]||"",placeholder:"0",sx:{width:100},slotProps:{input:{endAdornment:t.unit?e.jsx(i,{variant:"body2",color:"text.secondary",sx:{fontSize:"11px",ml:.5},children:t.unit}):void 0}}})})]},t.key))})})})}),e.jsx(r,{size:{xs:12,md:5},children:e.jsx(s,{title:"Label Preview",subtitle:"FDA-style nutrition label",children:e.jsxs(n,{className:"pxr-custom-nutrition-label",sx:{mx:"auto"},children:[e.jsx(i,{className:"nutrition-title",children:"Nutrition Facts"}),e.jsx(n,{className:"nutrition-servings",children:e.jsxs(i,{variant:"body2",children:["Serving size ",a.serving_size||"---"]})}),e.jsxs(n,{className:"nutrition-calories",children:[e.jsx(i,{variant:"body2",sx:{fontWeight:700},children:"Calories"}),e.jsx(i,{className:"amount",children:a.calories||0})]}),e.jsx(h,{sx:{borderWidth:4,borderColor:"#333",my:.5}}),e.jsx(i,{variant:"body2",sx:{textAlign:"right",fontSize:"10px",fontWeight:700},children:"% Daily Value*"}),o.slice(2).map(t=>e.jsx(n,{className:`nutrition-row ${t.indent?"":"bold"} ${t.indent?"indent":""}`,children:e.jsxs("span",{children:[t.label," ",a[t.key]||0,t.unit]})},t.key)),e.jsx(n,{className:"nutrition-footer",children:"* The % Daily Value tells you how much a nutrient in a serving of food contributes to a daily diet. 2,000 calories a day is used for general nutrition advice."})]})})})]})]})};export{S as default};
