PageSourceSearch

https://petwellhk.com/assets/NutritionScore-D5eItglQ.js

js petwellhk.com collected 2026-10-06 05:23:41 UTC 37,377 bytes, 16 lines download raw bytes

1import{r as u,j as e,L as J}from"./react-vendor-BDHNqS4B.js";import{e as ne,b as ie}from"./Header-BkbupWq-.js";import{F as le}from"./Footer-CtylQEAH.js";import{c as q,D as oe,j as de,k as ce,l as me,m as xe,L as $,I as M,B as k,A as ue,b as f,a2 as he,n as V,b0 as Q,X as pe}from"./main-m_sUF2N4.js";import{S as P}from"./skeleton-CDto_fTL.js";import{u as fe}from"./useSEO-CoArDrdl.js";import{a as ge,P as je}from"./AppDownloadCTA-DAEixTy3.js";import{s as T}from"./client-DdjVEhXX.js";import{t as K,g as Ne,B as be,r as ve,N as ye,a as we}from"./nutritionTheme-ByeotiTj.js";import{C as L}from"./camera-DiII9OQn.js";import{U as ke}from"./upload-B1g5jdtK.js";import{S as W}from"./shield-check-we62WOC3.js";import{S as ee}from"./sparkles-BcmYxR0H.js";import{C as _e}from"./circle-check-DgLC__8_.js";import{C as te}from"./check-DS0-tR9o.js";import{T as Se}from"./triangle-alert-1QSShUG6.js";import{M as Ce}from"./minus-xARKY3S7.js";import{S as ze}from"./search-BSw3vufk.js";import{S as Fe}from"./sliders-horizontal-zztTPW4P.js";import{C as Ae}from"./chevron-right-CpkQxGj-.js";import{C as Me}from"./cat-DaUUuSL6.js";import{D as Le}from"./dog-_P0n7k9m.js";import"./amplify-DYDcjoow.js";import"./tag-D40gy_Nl.js";import"./query-7-WHkg5t.js";import"./textarea-D7qsgB_p.js";import"./reportService-tEzofQZ6.js";import"./phone-B2rvvDkK.js";import"./type-CVgQCqWZ.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ee=q("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const se=q("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const X=q("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),Y=[{key:"upload",label:"上傳"},{key:"read",label:"讀取"},{key:"review",label:"核對"},{key:"result",label:"結果"}];function Re(t){switch(t){case"choose":return 0;case"extracting":return 1;case"confirm":return 2;case"scoring":case"result":case"email-done":return 3;default:return t}}function De(t){const c=K(t);return t>=75?{label:"可安心餵飼",tone:"safe",ring:c.ring,chip:c.chip}:t>=60?{label:"可用但需留意",tone:"caution",ring:c.ring,chip:c.chip}:{label:"不建議餵飼",tone:"risk",ring:c.ring,chip:c.chip}}function Pe(t){return Ne(t)}function Ie({current:t}){return e.jsx("div",{className:"flex items-center gap-0.5",children:Y.map((c,n)=>{const i=n<t,a=n===t;return e.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:f("flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-[10px] font-bold transition-all",i&&"bg-primary text-primary-foreground",a&&!i&&"border-2 border-primary bg-primary/10 text-primary",!i&&!a&&"border border-[hsl(var(--nutrition-line))] bg-white text-muted-foreground"),children:i?e.jsx(te,{className:"h-3.5 w-3.5","aria-hidden":"true"}):n+1}),n<Y.length-1?e.jsx("div",{className:f("h-0.5 flex-1 rounded-full",n<t?"bg-primary":"bg-[hsl(var(--nutrition-line))]"),"aria-hidden":"true"}):null]}),e.jsx("span",{className:f("text-center text-[10px] font-semibold uppercase tracking-wider",a?"text-foreground":"text-muted-foreground"),children:c.label})]},c.key)})})}function Oe({score:t,ringClass:c}){const[n,i]=u.useState(0);u.useEffect(()=>{const l=performance.now(),_=900;let j=0;const v=N=>{const g=Math.min(1,(N-l)/_),b=1-Math.pow(1-g,3);i(Math.round(t*b)),g<1&&(j=requestAnimationFrame(v))};return j=requestAnimationFrame(v),()=>cancelAnimationFrame(j)},[t]);const a=148,h=(a-10)/2,o=2*Math.PI*h,p=o-n/100*o;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",style:{width:a,height:a},"aria-hidden":"true",children:[e.jsxs("svg",{width:a,height:a,className:"-rotate-90",children:[e.jsx("circle",{cx:a/2,cy:a/2,r:h,strokeWidth:8,className:"stroke-muted fill-none"}),e.jsx("circle",{cx:a/2,cy:a/2,r:h,strokeWidth:8,strokeLinecap:"round",strokeDasharray:o,strokeDashoffset:p,className:f("fill-none transition-all",c)})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center leading-none",children:[e.jsx("div",{className:"nutrition-display text-4xl font-semibold tabular-nums",children:n}),e.jsxs("div",{className:"mt-1.5 text-xs text-muted-foreground",children:["/ 100 · ",Pe(t)]})]})]})}function U({tone:t,title:c,summary:n,detail:i,tip:a,defaultOpen:h}){const[o,p]=u.useState(!!h),l=!!(i||a),_={risk:"border-red-200/80 bg-red-50/50",caution:"border-amber-200/80 bg-amber-50/50",safe:"border-emerald-200/80 bg-emerald-50/50"}
16,j={risk:"text-red-600",caution:"text-amber-600",safe:"text-emerald-600"},v=t==="safe"?te:t==="risk"?Se:Ce;return e.jsxs("div",{className:f("nutrition-panel overflow-hidden !rounded-xl",_[t]),children:[e.jsxs("button",{type:"button",onClick:()=>l&&p(N=>!N),className:f("flex w-full items-start gap-3 p-4 text-left",!l&&"cursor-default"),"aria-expanded":l?o:void 0,children:[e.jsx(v,{className:f("mt-0.5 h-4 w-4 shrink-0",j[t]),"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:c}),e.jsx("div",{className:"mt-0.5 text-sm text-muted-foreground leading-relaxed",children:n})]}),l?e.jsx(ne,{className:f("h-4 w-4 shrink-0 text-muted-foreground transition-transform",o&&"rotate-180"),"aria-hidden":"true"}):null]}),o&&l?e.jsxs("div",{className:"space-y-3 border-t border-border/60 px-4 pb-4 pt-3",children:[i?e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"點解重要"}),e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-foreground/85",children:i})]}):null,a?e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"獸醫貼士"}),e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-foreground/85",children:a})]}):null]}):null]})}function Z({title:t,subtitle:c,tasks:n}){return e.jsxs("div",{className:"mx-auto max-w-sm py-8",children:[e.jsxs("div",{className:"nutrition-panel p-6 text-center",children:[e.jsx(V,{className:"mx-auto h-8 w-8 animate-spin text-primary","aria-hidden":"true"}),e.jsx("h2",{className:"nutrition-display mt-5 text-xl",children:t}),e.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:c})]}),e.jsx("div",{className:"mt-5 space-y-2",children:n.map((i,a)=>e.jsxs("div",{className:f("nutrition-panel flex items-center gap-3 px-4 py-3",a===0&&"border-primary/25 bg-primary/5"),children:[a===0?e.jsx(V,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-primary","aria-hidden":"true"}):e.jsx("div",{className:"h-3.5 w-3.5 shrink-0 rounded-full border border-[hsl(var(--nutrition-line))] bg-white","aria-hidden":"true"}),e.jsx("span",{className:f("text-sm",a===0?"font-medium text-foreground":"text-muted-foreground"),children:i})]},i))})]})}async function $e(t){return new Promise((c,n)=>{const i=new FileReader;i.onload=()=>c(i.result),i.onerror=n,i.readAsDataURL(t)})}async function Te(t){const c=await $e(t),n=new Image;await new Promise((p,l)=>{n.onload=()=>p(),n.onerror=l,n.src=c});const i=1600;let{width:a,height:h}=n;if(a>i||h>i){const p=Math.min(i/a,i/h);a=Math.round(a*p),h=Math.round(h*p)}const o=document.createElement("canvas");return o.width=a,o.height=h,o.getContext("2d").drawImage(n,0,0,a,h),o.toDataURL("image/jpeg",.85)}const Ue=[{key:"protein_percent",label:"蛋白"},{key:"fat_percent",label:"脂肪"},{key:"fiber_percent",label:"纖維"},{key:"moisture_percent",label:"水分"},{key:"ash_percent",label:"灰分"}];function Be({open:t,onOpenChange:c}){var H;const[n,i]=u.useState("choose"),[a,h]=u.useState(""),[o,p]=u.useState(null),[l,_]=u.useState(null),[j,v]=u.useState(""),[N,g]=u.useState(""),b=u.useRef(null),S=u.useRef(null),I=()=>{i("choose"),h(""),p(null),_(null),v(""),g("")},F=()=>{c(!1),setTimeout(I,300)},A=async s=>{g(""),i("extracting");try{const m=await Te(s);h(m);const{data:w,error:G}=await T.functions.invoke("analyze-pet-food-label",{body:{action:"extract",imageDataUrl:m}});if(G)throw G;const O=w;if(!O.is_food_label){g(O.reject_reason||"呢張相似乎唔係寵物糧
16食標籤,請重試。"),i("choose");return}p(O),i("confirm")}catch(m){const w=m instanceof Error?m.message:"";g("分析失敗,請重試。"+(w?` (${w})`:"")),i("choose")}},E=async()=>{if(o){i("scoring");try{const{data:s,error:m}=await T.functions.invoke("analyze-pet-food-label",{body:{action:"score",payload:o}});if(m)throw m;_(s),i("result")}catch{g("評分失敗,請重試。"),i("confirm")}}},R=async()=>{if(!j||!j.includes("@")){Q({title:"請輸入有效電郵",variant:"destructive"});return}try{await T.functions.invoke("analyze-pet-food-label",{body:{action:"score",payload:o,email:j}}),i("email-done")}catch{Q({title:"提交失敗,請重試",variant:"destructive"})}},r=(s,m)=>{if(!o)return;const w=m===""?null:Number(m);p({...o,raw_data:{...o.raw_data,[s]:Number.isNaN(w)?null:w}})},d=l?De(l.scoring.total_score):null,x=l==null?void 0:l.ingredient_analysis,y=l==null?void 0:l.calculated_data,C=[],z=[],D=[];x&&(x.has_artificial_preservatives&&C.push({title:"含人工防腐劑",summary:"偵測到 BHA / BHT / Ethoxyquin 或類似成份。",detail:"呢類化學防腐劑長期食用可能同肝腎壓力有關,係國際獸醫營養學界普遍會建議避免嘅成份。",tip:"揀用維他命 E(Mixed Tocopherols)或迷迭香萃取作為天然防腐嘅配方會更安全。"}),x.has_artificial_colors_or_sugars&&C.push({title:"含人工色素或添加糖",summary:"配方入面出現色素或糖分,對毛孩並無營養價值。",detail
16:"人工色素只係為咗吸引主人購買,對寵物可能引起腸胃或行為敏感;糖分長期過量會增加肥胖及糖尿風險。",tip:"選擇成份表越短越樸實嘅產品,成份純度反而更重要。"}),x.has_unnamed_meat_or_byproducts&&z.push({title:"含未命名肉源或副產品",summary:"例如「meat meal」、「animal fat」等冇註明係咩肉類。",detail:"未命名肉源代表原料來源不透明,品質和穩定性難以追蹤,敏感體質嘅毛孩可能會出現皮膚或腸胃反應。",tip:"認住成份表以「Chicken」、「Salmon」等具體肉類為首個成份嘅配方。"}),x.has_high_gi_carbs_or_fillers&&z.push({title:"含高 GI 碳水或填充料",summary:"例如粟米、麥、白米、麥芽糊精。",detail:"呢啲成份可以令飽足感上升,但同時會令血糖起伏較大,長期依賴會增加肥胖或糖尿風險。",tip:"揀用番薯、鷹嘴豆、燕麥等低升糖指數碳水源會更理想。"}),x.is_first_ingredient_named_meat&&D.push({title:"首個成份係優質肉源",summary:`${x.first_ingredient||"已命名肉類"} 排列第一,蛋白質基礎理想。`,detail:"AAFCO 建議犬貓糧首個成份最好係命名肉類,代表配方以動物性蛋白為主,較符合肉食性動物需求。",tip:"呢類配方特別適合活躍犬貓,可以維持肌肉健康。"})),y&&(y.dmb_protein_percent>=28&&D.push({title:`蛋白質水平充足(乾物基 ${y.dmb_protein_percent.toFixed(1)}%)`,summary:"達到 AAFCO 成犬/成貓維持量以上。",detail:"蛋白質提供必需胺基酸,維持毛髮、肌肉和免疫系統。乾物基(DMB)換算比包裝上嘅「原始 %」更能反映真實濃度。",tip:"老年或腎臟指數偏高嘅毛孩,記得同獸醫討論適合嘅蛋白質範圍。"}),y.fat_to_protein_ratio>=90&&z.push({title:`脂蛋白比偏高(FPR ${y.fat_to_protein_ratio.toFixed(0)}%)`,summary:"脂肪相對於蛋白比例過高,暗示廉價脂肪替代蛋白。",detail:"健康乾糧一般 FPR 在 40–75% 之間;長期過高可能導致胰臟壓力和體重上升。",tip:"如你嘅毛孩體型偏胖或曾患胰臟炎,應優先揀 FPR 較低嘅配方。"}));const ae=Re(n);return e.jsx(oe,{open:t,onOpenChange:s=>{s?c(s):F()},children:e.jsxs(de,{className:"nutrition-analyzer max-h-[92vh] max-w-lg gap-0 overflow-y-auto border border-[hsl(var(--nutrition-line))] p-0 sm:max-w-[580px] sm:rounded-2xl",children:[e.jsxs(ce,{className:"sr-only",children:[e.jsx(me,{children:"寵物糧營養分析"}),e.jsx(xe,{children:"PetWell 糧食標籤即時評分"})]}),e.jsxs("div",{className:"sticky top-0 z-10 border-b border-[hsl(var(--nutrition-line))] bg-[hsl(var(--nutrition-canvas))]/95 px-5 py-4 backdrop-blur supports-[backdrop-filter]:bg-[hsl(var(--nutrition-canvas))]/90",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-primary","aria-hidden":"true"}),e.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"糧食標籤分析"})]}),e.jsx("span",{className:"rounded-full border border-[hsl(var(--nutrition-line))] bg-white px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"PetWell"})]}),e.jsx(Ie,{current:ae})]}),e.jsxs("div",{className:"px-5 pb-6 pt-5 md:px-6",children:[n==="choose"&&e.jsxs("div",{className:"mx-auto max-w-sm space-y-5",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"nutrition-display text-2xl",children:"掃描營養標籤"}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:"對準保證分析同成份表,AI 會讀取並計分。"})]}),N?e.jsxs("div",{className:"flex gap-2.5 rounded-xl border border-red-200/80 bg-red-50/60 p-3 text-sm text-red-800",children:[e.jsx(X,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),N]}):null,e.jsxs("div",{className:"nutrition-scanner-zone",children:[e.jsx("span",{className:"nutrition-scanner-zone__corner nutrition-scanner-zone__corner--tl","aria-hidden":"true"}
16),e.jsx("span",{className:"nutrition-scanner-zone__corner nutrition-scanner-zone__corner--tr","aria-hidden":"true"}),e.jsx("span",{className:"nutrition-scanner-zone__corner nutrition-scanner-zone__corner--bl","aria-hidden":"true"}),e.jsx("span",{className:"nutrition-scanner-zone__corner nutrition-scanner-zone__corner--br","aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-col items-center gap-4 py-2",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:e.jsx(L,{className:"h-7 w-7 text-primary","aria-hidden":"true"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"選擇上傳方式"}),e.jsxs("div",{className:"grid w-full grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{var s;return(s=S.current)==null?void 0:s.click()},className:"inline-flex h-11 items-center justify-center gap-2 rounded-full bg-primary text-sm font-semibold text-primary-foreground transition-transform active:scale-[0.98]",children:[e.jsx(L,{className:"h-4 w-4","aria-hidden":"true"}),"影相"]}),e.jsxs("button",{type:"button",onClick:()=>{var s;return(s=b.current)==null?void 0:s.click()},className:"inline-flex h-11 items-center justify-center gap-2 rounded-full border border-[hsl(var(--nutrition-line))] bg-white text-sm font-semibold transition-colors hover:border-primary/30",children:[e.jsx(ke,{className:"h-4 w-4","aria-hidden":"true"}),"上載"]})]})]})]}),e.jsx("input",{ref:S,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:s=>{var m;return((m=s.target.files)==null?void 0:m[0])&&A(s.target.files[0])}}),e.jsx("input",{ref:b,type:"file",accept:"image/*",hidden:!0,onChange:s=>{var m;return((m=s.target.files)==null?void 0:m[0])&&A(s.target.files[0])}}),e.jsxs("p",{className:"flex items-center justify-center gap-1.5 text-center text-xs text-muted-foreground",children:[e.jsx(W,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"中立分析,唔收品牌贊助"]})]}
16),n==="extracting"&&e.jsx(Z,{title:"讀取標籤中",subtitle:"大約需要 10–20 秒",tasks:["辨識保證分析數值","提取成份表文字","核對產品資訊"]}),n==="confirm"&&o&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"nutrition-display text-xl",children:"核對讀取結果"}),e.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:"如有錯漏可直接修改,確認後開始評分。"})]}),N?e.jsxs("div",{className:"flex gap-2.5 rounded-lg border border-red-200/80 bg-red-50/50 p-3 text-sm text-red-800",children:[e.jsx(X,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),N]}):null,a?e.jsx("div",{className:"nutrition-panel overflow-hidden p-2",children:e.jsx("img",{src:a,alt:"上傳嘅營養標籤",className:"max-h-44 w-full rounded-lg object-contain"})}):null,e.jsxs("div",{className:"nutrition-panel p-4",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"AI 讀到嘅內容"}),e.jsx("p",{className:"mt-1.5 max-h-28 overflow-y-auto whitespace-pre-wrap text-sm leading-relaxed text-foreground/85",children:o.label_text_zh})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"brand",className:"text-xs text-muted-foreground",children:"品牌"}),e.jsx(M,{id:"brand",value:o.brand_name??"",onChange:s=>p({...o,brand_name:s.target.value}),className:"h-10"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{htmlFor:"product",className:"text-xs text-muted-foreground",children:"產品"}),e.jsx(M,{id:"product",value:o.product_name??"",onChange:s=>p({...o,product_name:s.target.value}),className:"h-10"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"保證分析(As-Fed %)"}),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:Ue.map(({key:s,label:m})=>e.jsxs("div",{className:"space-y-1",children:[e.jsx($,{className:"text-[10px] text-muted-foreground",children:m}),e.jsx(M,{type:"number",step:"0.1",value:o.raw_data[s]??"",onChange:w=>r(s,w.target.value),className:"h-9 px-2 text-center text-sm tabular-nums"})]},s))})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(k,{variant:"outline",onClick:()=>{g(""),i("choose")},className:"h-11 gap-1.5 rounded-full border-[hsl(var(--nutrition-line))] bg-white",children:[e.jsx(ue,{className:"h-4 w-4","aria-hidden":"true"}),"重新上傳"]}),e.jsxs(k,{onClick:E,className:"nutrition-scan-cta h-11 flex-1 gap-2 rounded-full border-0",children:[e.jsx(ee,{className:"h-4 w-4","aria-hidden":"true"}),"確認並評分"]})]})]}),n==="scoring"&&e.jsx(Z,{title:"計算評分中",subtitle:"分析營養比例同成份質素",tasks:["換算乾物質基準","評估配方質素","生成評測報告"]}),n==="result"&&l&&d&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"nutrition-panel p-6 text-center",children:[e.jsx(Oe,{score:l.scoring.total_score,ringClass:d.ring}),e.jsx("div",{className:f("mt-4 inline-flex items-center rounded-full border px-3 py-1 text-xs font-semibold",d.chip),children:d.label}),e.jsx("h2",{className:"nutrition-display mt-4 text-xl",children:l.product_info.brand_name||"未命名品牌"}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:l.product_info.product_name||"未命名產品"}),e.jsx("p",{className:"mx-auto mt-3 max-w-sm text-sm leading-relaxed text-muted-foreground",children:((H=l.evaluation_report)==null?void 0:H.summary)||`此配方符合基本營養標準${z.length?`,但含 ${z.length} 個需要留意嘅成份`:""}${C.length?`,並偵測到 ${C.length} 個高風險成份`:""}。`})]}),e.jsxs("div",{className:"nutrition-panel grid grid-cols-3 divide-x divide-[hsl(var(--nutrition-line))] overflow-hidden p-0",children:[e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:"蛋白"}),e.jsx("div",{className:"nutrition-display mt-1 text-lg tabular-nums",children:y?`${y.dmb_protein_percent.toFixed(0)}%`:"—"})]}),e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:"添加劑風險"}),e.jsx("div",{className:"nutrition-display mt-1 text-lg",children:C.length===0?"低":C.length===1?"中":"高"})]}),e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:"營養平衡"}),e.jsx("div",{className:"nutrition-display mt-1 text-lg",children:l.scoring.core_nutrition_score>=30?"良好":l.scoring.core_nutrition_score>=20?"尚可":"偏差"})]})]}),C.length+z.length+D.length>0?e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"成份剖析"}),e.jsxs("div",{className:"space-y-2",children:[C.map((s,m)=>
16e.jsx(U,{tone:"risk",title:s.title,summary:s.summary,detail:s.detail,tip:s.tip,defaultOpen:m===0},`rf-${m}`)),z.map((s,m)=>e.jsx(U,{tone:"caution",title:s.title,summary:s.summary,detail:s.detail,tip:s.tip},`wo-${m}`)),D.map((s,m)=>e.jsx(U,{tone:"safe",title:s.title,summary:s.summary,detail:s.detail,tip:s.tip},`gp-${m}`))]})]}):null,e.jsxs("div",{className:"nutrition-panel p-4",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:"建議"}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed",children:d.tone==="risk"?"建議考慮換一款首個成份為命名肉類、無人工防腐劑嘅配方,並留意毛孩換糧後嘅腸胃反應。":d.tone==="caution"?"此配方基礎可以,但可以留意毛孩有冇痕癢、軟便或體重變化,作為換糧與否嘅參考。":"此配方營養結構理想,可繼續餵飼,定期覆核毛孩體重同毛髮狀態即可。"})]}),e.jsxs("div",{className:"nutrition-panel p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-primary","aria-hidden":"true"}),e.jsx("span",{className:"text-sm font-semibold",children:"儲存報告"})]}),e.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:"留低電郵,我哋會將完整報告 send 俾你。"}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsx(M,{type:"email",placeholder:"[email protected]",value:j,onChange:s=>v(s.target.value),className:"h-10 flex-1"}),e.jsx(k,{onClick:R,className:"h-10 shrink-0 px-4",children:"傳送"})]}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"唔會發垃圾郵件,隨時可以取消訂閱。"})]}),e.jsxs("div",{className:"nutrition-panel p-4 text-center",children:[e.jsx("p",{className:"text-sm font-semibold",children:"用 App 比較更多糧食"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"即刻同其他相似產品比較蛋白質、成份同性價比。"}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",className:"flex-1",asChild:!0,children:e.jsx("a",{href:ge,target:"_blank",rel:"noopener noreferrer",children:"App Store"})}),e.jsx(k,{variant:"outline",size:"sm",className:"flex-1",asChild:!0,children:e.jsx("a",{href:je,target:"_blank",rel:"noopener noreferrer",children:"Google Play"})})]})]}),e.jsx("p",{className:"text-center text-[11px] leading-relaxed text-muted-foreground",children:"本評分僅供教育參考,最終健康建議請以獸醫意見為準。"})]}),n==="email-done"&&e.jsxs("div",{className:"mx-auto flex max-w-sm flex-col items-center py-10 text-center",children:[e.jsx("div",{className:"nutrition-panel flex h-16 w-16 items-center justify-center rounded-full p-0",children:e.jsx(_e,{className:"h-8 w-8 text-emerald-600","aria-hidden":"true"})}),e.jsx("h2",{className:"nutrition-display mt-5 text-2xl",children:"已收到"}),e.jsxs("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:["我哋會將完整報告於 24 小時內電郵至 ",e.jsx("span",{className:"font-medium text-foreground",children:j}),"。"]}),e.jsx(k,{onClick:F,variant:"outline",className:"mt-6 h-10",children:"關閉"})]})]})]})})}const re={all:{label:"全部",short:"全部"},dry:{label:"乾糧",short:"乾糧"},wet:{label:"濕糧",short:"濕糧"},"freeze-dried":{label:"凍乾/生食",short:"凍乾"},treat:{label:"零食",short:"零食"}},We=[{points:"40%",title:"核心營養",icon:be,description:"乾物質基準換算,公平對比每款糧。"},{points:"60%",title:"配方質素",icon:ee,description:"評估肉源、副產品同碳水來源。"},{points:"25%",title:"爭議成份",icon:Ee,description:"人工防腐劑、色素等會扣分。"}];function qe({food:t,index:c}){var l;const n=ve(t.rating),i=K(n),a=t.nutrition,h=a.dryProtein??a.protein,o=a.dryFat??a.fat,p=((l=re[t.form==="raw"?"freeze-dried":t.form])==null?void 0:l.short)??t.form;return e.jsxs(J,{to:`/nutrition/${t.id}`,className:f("nutrition-food-row group pl-5",c<8&&`nutrition-reveal nutrition-reveal-delay-${Math.min(c%3,2)+1}`),style:{animationDelay:c<8?`${c*40}ms`:void 0},children:[e.jsx("span",{className:f("absolute left-0 top-0 bottom-0 w-[3px] rounded-l-2xl",i.stripe),"aria-hidden":"true"}),e.jsx(ye,{score:n,size:54}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:t.brand}),e.jsx("h3",{className:"nutrition-display mt-0.5 truncate text-lg leading-snug text-foreground",children:t.name}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.jsx(we,{score:n}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[p,t.grainInfo?` · ${t.grainInfo}`:""]})]}),t.summary?e.jsx("p",{className:"mt-2 hidden line-clamp-1 text-sm text-muted-foreground md:block",children:t.summary}):null]}),e.jsxs("div",{className:"hidden shrink-0 gap-6 border-l border-[hsl(var(--nutrition-line))] pl-5 sm:flex",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:"蛋白"}),e.jsx("div",{className:"nutrition-display mt-0.5 text-base tabular-nums",children:h!=null?`${h}%`:"—"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:"脂肪"}),e.jsx("div",{className:"nutrition-display mt-0.5 text-base tabular-nums",children:o!=null?`${o}%`:"—"})]})]}),e.jsx(Ae,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary","aria-hidden":"true"})]})}
16function He(){return e.jsxs("div",{className:"nutrition-panel flex items-center gap-4 p-4 md:p-5",children:[e.jsx(P,{className:"h-[54px] w-[54px] shrink-0 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(P,{className:"h-3 w-24"}),e.jsx(P,{className:"h-5 w-3/4 max-w-xs"}),e.jsx(P,{className:"h-5 w-28"})]})]})}const B=24;function vt(){const[t,c]=u.useState("dog"),[n,i]=u.useState("all"),[a,h]=u.useState(""),[o,p]=u.useState(B),[l,_]=u.useState(null),[j,v]=u.useState(!1),[N,g]=u.useState(!1);fe({title:"糧食評分|PetWell 中立寵物糧營養評測",description:"PetWell 自家糧食評分系統,收錄過千款貓糧、狗糧同零食。以公開營養標籤加權計分,唔收品牌費,幫你揀啱毛孩每日食嘅嘢。",canonicalUrl:"https://petwellhk.com/nutrition"}),u.useEffect(()=>{fetch("/data/nutrition-products.json").then(r=>r.json()).then(r=>_(r)).catch(()=>v(!0))},[]),u.useEffect(()=>{p(B)},[t,n,a]);const b=u.useMemo(()=>(l??[]).filter(r=>r.species===t),[l,t]),S=u.useMemo(()=>{let r=b;n==="freeze-dried"?r=r.filter(x=>x.form==="freeze-dried"||x.form==="raw"):n!=="all"&&(r=r.filter(x=>x.form===n));const d=a.trim().toLowerCase();return d&&(r=r.filter(x=>x.brand.toLowerCase().includes(d)||x.name.toLowerCase().includes(d)||x.foodType.toLowerCase().includes(d))),r},[b,n,a]),I=u.useMemo(()=>{const r={all:b.length,dry:0,wet:0,"freeze-dried":0,treat:0};for(const d of b)d.form==="dry"?r.dry++:d.form==="wet"?r.wet++:d.form==="freeze-dried"||d.form==="raw"?r["freeze-dried"]++:d.form==="treat"&&r.treat++;return r},[b]),F=S.slice(0,o),A=n!=="all"||a.trim().length>0,E=(l==null?void 0:l.length)??0,R=()=>{i("all"),h("")};return e.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[e.jsx(ie,{}),e.jsxs("main",{className:"nutrition-page flex-1 pb-16",children:[e.jsx("section",{className:"nutrition-hero",children:e.jsxs("div",{className:"container relative mx-auto max-w-4xl px-4 py-10 md:py-14",children:[e.jsxs("div",{className:"nutrition-reveal flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[hsl(var(--nutrition-line))] bg-white/70 px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.18em] text-primary backdrop-blur-sm",children:[e.jsx(se,{className:"h-3 w-3","aria-hidden":"true"}),"糧食評分系統"]}),e.jsxs("h1",{className:"nutrition-display mt-5 text-4xl leading-[1.05] text-foreground md:text-5xl",children:["毛孩食糧,",e.jsx("br",{}),e.jsx("span",{className:"text-primary",children:"幾多分先夠放心?"})]}),e.jsxs("p",{className:"mt-4 max-w-lg text-[15px] leading-relaxed text-muted-foreground",children:["收錄 ",E>0?E.toLocaleString():"過千"," 款貓糧、狗糧同零食。根據公開營養標籤計分,公式透明,唔收品牌費。"]})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row lg:flex-col lg:items-end",children:[e.jsxs("button",{type:"button",onClick:()=>g(!0),className:"nutrition-scan-cta inline-flex h-12 items-center justify-center gap-2 rounded-full px-6 text-sm font-semibold",children:[e.jsx(L,{className:"h-4 w-4","aria-hidden":"true"}),"影相分析"]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(W,{className:"h-3.5 w-3.5 text-primary","aria-hidden":"true"}),"中立評分 · 唔收品牌費"]})]})]}),e.jsx("div",{className:"nutrition-reveal nutrition-reveal-delay-2 mt-8 grid gap-3 sm:grid-cols-3",children:We.map(({points:r,title:d,icon:x,description:y})=>e.jsxs("div",{className:"nutrition-method-pill",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-4 w-4 text-primary","aria-hidden":"true"}),e.jsx("span",{className:"nutrition-display text-xl tabular-nums",children:r})]}),e.jsx("p",{className:"mt-1 text-sm font-semibold",children:d}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:y})]},d))})]})}),e.jsxs("div",{className:"container mx-auto max-w-4xl px-4",children:[e.jsx("div",{id:"nutrition-list",className:"nutrition-toolbar sticky top-[var(--header-height)] z-20 -mx-4 px-4 py-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("nav",{"aria-label":"寵物類別",className:"flex gap-1 rounded-full border border-[hsl(var(--nutrition-line))] bg-white p-1",children:["dog","cat"].map(r=>{const d=r==="cat"?Me:Le,x=t===r;return e.jsxs("button",{type:"button",onClick:()=>c(r),className:f("inline-flex items-center gap-1.5 rounded-full px-4 py-2 text-sm font-medium transition-colors",x?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),"aria-pressed":x,children:[e.jsx(d,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r==="cat"?"貓糧":"狗糧"]},r)})}),e.jsxs("button",{type:"button",onClick:()=>g(!0),className:"inline-flex h-9 items-center gap-1.5 rounded-full border border-primary/25 bg-primary/5 px-3.5 text-xs font-semibold text-primary transition-colors hover:bg-primary/10 md:hidden",children:[e.jsx(L,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"影相分析"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ze,{className:"pointer-events-none absolute left-3.5 to
16p-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground","aria-hidden":"true"}),e.jsx(M,{type:"search",value:a,onChange:r=>h(r.target.value),placeholder:"搜尋品牌或產品名",className:"h-11 rounded-xl border-[hsl(var(--nutrition-line))] bg-white pl-10 shadow-none","aria-label":"搜尋品牌或產品名"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"mr-1 hidden items-center gap-1.5 text-[11px] font-semibold uppercase tracking-widest text-muted-foreground sm:inline-flex",children:[e.jsx(Fe,{className:"h-3 w-3","aria-hidden":"true"}),"糧型"]}),["all","dry","wet","freeze-dried","treat"].map(r=>{const d=n===r,x=I[r];return e.jsxs("button",{type:"button",onClick:()=>i(r),disabled:x===0&&!d,"aria-pressed":d,className:f("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors",d?"border-primary/40 bg-primary/10 text-primary":"border-[hsl(var(--nutrition-line))] bg-white text-muted-foreground hover:border-primary/25 hover:text-foreground",x===0&&!d&&"opacity-40"),children:[re[r].label,e.jsx("span",{className:"tabular-nums opacity-70",children:x})]},r)}),A?e.jsxs("button",{type:"button",onClick:R,className:"inline-flex items-center gap-1 px-2 py-1.5 text-xs font-medium text-muted-foreground hover:text-primary",children:[e.jsx(pe,{className:"h-3 w-3","aria-hidden":"true"}),"清除"]}):null]})]})}),e.jsx("div",{className:"pt-6",children:l===null?e.jsx("div",{className:"space-y-3","aria-busy":"true","aria-label":"載入評測資料中",children:Array.from({length:6}).map((r,d)=>e.jsx(He,{},d))}):j?e.jsxs("div",{className:"nutrition-panel py-20 text-center",children:[e.jsx("p",{className:"text-base font-semibold",children:"載入失敗"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"請刷新頁面再試。"})]}):S.length===0?e.jsxs("div",{className:"nutrition-panel py-20 text-center",children:[e.jsx("p",{className:"text-base font-semibold",children:"冇符合條件嘅評測"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"試下清除搜尋或轉個篩選條件。"}),A?e.jsx(k,{variant:"outline",size:"sm",onClick:R,className:"mt-5 rounded-full",children:"清除篩選"}):null]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mb-4 text-sm tabular-nums text-muted-foreground",children:["顯示 ",F.length.toLocaleString()," / ",S.length.toLocaleString()," 款"]}),e.jsx("section",{"aria-label":"糧食評測列表",className:"space-y-3",children:F.map((r,d)=>e.jsx(qe,{food:r,index:d},r.id))}),o<S.length?e.jsx("div",{className:"mt-10 text-center",children:e.jsxs(k,{size:"lg",variant:"outline",className:"rounded-full border-[hsl(var(--nutrition-line))] bg-white",onClick:()=>p(r=>r+B),children:["載入更多(仲有 ",(S.length-o).toLocaleString()," 款)"]})}):null]})}),e.jsx("section",{className:"mt-14",children:e.jsxs("div",{className:"nutrition-panel overflow-hidden p-6 md:flex md:items-center md:justify-between md:gap-8 md:p-8",children:[e.jsxs("div",{className:"max-w-md",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-primary",children:"即時分析"}),e.jsx("h2",{className:"nutrition-display mt-2 text-2xl",children:"搵唔到你隻糧?"}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:"影張營養標籤,AI 逐項讀取成份同保證分析,即刻出分。"})]}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-3 md:mt-0 md:shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>g(!0),className:"nutrition-scan-cta inline-flex h-11 items-center gap-2 rounded-full px-6 text-sm font-semibold",children:[e.jsx(L,{className:"h-4 w-4","aria-hidden":"true"}),"影相分析"]}),e.jsx(k,{variant:"outline",asChild:!0,className:"h-11 rounded-full border-[hsl(var(--nutrition-line))] bg-transparent",children:e.jsx(J,{to:"/download",children:"下載 App"})})]})]})}),e.jsx("footer",{className:"mt-8 pb-6",children:e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-[hsl(var(--nutrition-line))] bg-white/60 px-4 py-4 text-xs leading-relaxed text-muted-foreground md:text-sm",children:[e.jsx(W,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary/70","aria-hidden":"true"}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-foreground
16/85",children:"中立聲明:"}),"PetWell 從不收取品牌費用,評分係根據公開營養標籤自行計算。分數只反映配方組成,最終請以獸醫意見為準。發現資料有誤,歡迎 WhatsApp 55954078。"]})]})})]})]}),e.jsx(le,{}),e.jsx(Be,{open:N,onOpenChange:g})]})}export{vt 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.