1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5132],{85132:(e,t,l)=>{l.d(t,{A:()=>k});var n=l(37876),a=l(15039),r=l.n(a),i=l(89033),s=l(54587),o=l.n(s),c=l(89099),d=l(14232),m=l(69936),x=l(16253),u=l(94697),h=l(31805),p=l(46637);function f(e){var t,l,a,r,s;let{flavor:c,isOpen:d,onClose:f}=e,{data:j,loading:b}=(0,p.zx)({flavorId:null==c?void 0:c.typeId}),v=null==j||null==(t=j.cookies)?void 0:t.cookieDetails,{t:g}=(0,i.Bd)("nutrition");return(0,n.jsx)(h.A,{variant:"secondaryNoDivider",onClose:f,isOpen:d,children:(0,n.jsx)("div",{className:"flex flex-col gap-y-[15px] mt-5 mx-1",children:b?(0,n.jsx)(x.A,{}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex gap-2.5 sm:gap-6 items-center",children:[(null==c?void 0:c.image)&&(0,n.jsx)(o(),{src:null==c?void 0:c.image,alt:g("cookie_image"),width:120,height:120,className:"w-[120px] h-[120px] sm:w-[154px] sm:h-[154px] rounded-full flex-shrink-0"}),(0,n.jsxs)("div",{children:[(0,n.jsx)(m.A,{variant:"title3",children:(null==c?void 0:c.type)===g("mini_desserts")?"".concat(g("dessert_mini",{dessert:null==c?void 0:c.name})):null==c?void 0:c.name}),(0,n.jsx)(m.A,{variant:"body2",children:null==v?void 0:v.description})]})]}),(0,n.jsx)(u.A,{title:g("allergy_information"),children:(0,n.jsxs)("div",{className:"flex flex-col space-y-4",children:[(null==v||null==(l=v.allergyInformation)?void 0:l.description)&&(0,n.jsx)(m.A,{variant:"title3",children:g("nutrition:contains_ingredients",{ingredients:null==v||null==(a=v.allergyInformation)?void 0:a.description})}),(null==v||null==(r=v.mayContainAllergyInformation)?void 0:r.description)&&(0,n.jsx)(m.A,{variant:"title3",children:g("may_contain_ingredients",{ingredients:null==v||null==(s=v.mayContainAllergyInformation)?void 0:s.description})}),(0,n.jsx)(m.A,{children:g("may_contain_note")})]})})]})})})}function j(){return["row-0","row-1","row-2","row-3","row-4","row-5","row-6","row-7","row-8","row-9"].map(e=>(0,n.jsxs)("tr",{className:"border-b border-solid border-black/10 relative h-[68px]",children:[(0,n.jsx)("td",{className:"min-w-[150px] w-[300px] sticky left-0 bg-white z-10 lg:min-w-[300px]",children:(0,n.jsx)("div",{className:"h-10 bg-gray-200 rounded animate-pulse mx-1"})}),["cell-0","cell-1","cell-2","cell-3","cell-4","cell-5","cell-6","cell-7","cell-8","cell-9"].map((e,t)=>(0,n.jsx)("td",{className:r()("text-center h-full",t%2==0&&"bg-secondary-light"),children:(0,n.jsx)("div",{className:"h-10 bg-gray-200 rounded animate-pulse mx-1"})},e))]},e))}var b=l(80447);let v=()=>"function"==typeof window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches;function g(e){let{contains:t,nuts:l}=e,{t:a}=(0,i.Bd)("nutrition"),[r,s]=(0,d.useState)(!1),c=(0,d.useRef)(null),m=(0,d.useRef)(!1),x=(0,d.useId)();return(0,d.useEffect)(()=>{if(!r)return;let e=e=>{var t;null!=(t=c.current)&&t.contains(e.target)||(m.current=!1,s(!1))},t=e=>{"Escape"===e.key&&(m.current=!1,s(!1))};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[r]),(0,n.jsxs)("div",{ref:c,className:"relative",onMouseEnter:()=>{v()&&(m.current=!0,s(!0))},onMouseLeave:()=>{v()&&(m.current=!1,s(!1))},children:[(0,n.jsx)("button",{type:"button",className:"cursor-pointer","aria-expanded":r,"aria-controls":x,"aria-label":a("tooltip"),onClick:()=>{m.current||s(e=>!e)},children:(0,n.jsx)(o(),{src:b.A,alt:"","aria-hidden":!0})}),r?(0,n.jsxs)("div",{id:x,role:"tooltip",className:"absolute bottom-full left-1/2 z-20 mb-2 translate-y-full whitespace-nowrap rounded bg-black p-2 text-left text-white",children:[(0,n.jsx)("div",{children:a(t?"contains":"may_contain")}),l.map(e=>(0,n.jsx)("div",{children:a(e)},e))]}):null]})}var w=l(24891);let y=["almond","brazilNut","cashew","coconut","hazelnut","macadamiaNut","pineNut","pistachio","pecan","walnut"],N=["milk","egg","soy","wheat","sesame","treeNuts","peanut","fish","shellfish"],_=["milk","egg","soy","wheat","sesame","treeNut","peanut","fish","shellfish"];function k(e){let{filteredItemData:t,selectedTab:l,loadingItemsData:a=!1,showNutritionFacts:r=!0,chrome:s}=e,{scrollId:o}=(0,c.useRouter)().query,m=Array.isArray(o)?o[0]:o||"",[x,u]=(0,d.useState)(!1),[h,p]=(0,d.useState)(null),[j]=(0,i.Bd)("nutrition"),b=(0,d.useRef)(null);(0,d.useEffect)(()=>{var e;if(!o||x)return;let t=document.getElementById(m),l=b.current;if(!t||!l)return;u(!0);let n=l.querySelector("thead"),a=null!=(e=null==n?void 0:n.getBoundingClientRect().height)?e:120,r
1=l.getBoundingClientRect().top,i=t.getBoundingClientRect().top;l.scrollTo({top:l.scrollTop+(i-r)-a-16,behavior:"smooth"})},[o,m,x,t]);let v=r&&l===j("nutrition");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex flex-col flex-1 min-h-0 w-full",children:v?(0,n.jsx)(I,{filteredItemData:t,setSelectedFlavor:p,loadingItemsData:a,chrome:s,bodyScrollRef:b}):(0,n.jsx)(A,{filteredItemData:t,setSelectedFlavor:p,loadingItemsData:a,chrome:s,bodyScrollRef:b})}),(0,n.jsx)(f,{flavor:h,isOpen:!!h,onClose:()=>p(null)})]})}let I=e=>{let{filteredItemData:t,setSelectedFlavor:l,loadingItemsData:a,chrome:s,bodyScrollRef:o}=e,{t:c}=(0,i.Bd)("nutrition"),x=!a&&(!t||0===t.length),u=(0,d.useMemo)(()=>{if(!t||0===t.length)return[];let e=null==t?void 0:t.find(e=>e.nutritionInformation),l=null==e?void 0:e.nutritionInformation;return l?Object.keys(l).filter(e=>l[e]&&"object"==typeof l[e]&&l[e].total):[]},[t]),h=(0,d.useMemo)(()=>e=>e.nutritionInformation?u.map(t=>{var l;let n=e.nutritionInformation[t];return(null==n||null==(l=n.total)?void 0:l.value)||0}):u.map(()=>0),[u]);return(0,n.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 w-full",children:[(0,n.jsx)("div",{className:"flex-shrink-0 relative z-40 bg-white",children:s}),(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",ref:o,children:(0,n.jsxs)("table",{className:"w-full table-auto",role:"table","aria-label":c("nutrition_information_table"),children:[(0,n.jsx)("thead",{className:"sticky top-0 z-20 bg-white",children:(0,n.jsxs)("tr",{className:"h-[100px] border-b border-solid border-black/10",role:"row",children:[(0,n.jsx)("th",{className:"sticky left-0 bg-gradient-to-r from-white to-transparent z-30 min-w-[150px] w-[300px] lg:min-w-[300px]",scope:"col","aria-label":c("product_name")}),u.map(e=>(0,n.jsx)("th",{className:"text-left w-auto whitespace-nowrap bg-white",scope:"col",role:"columnheader",children:(0,n.jsx)(m.A,{variant:"finePrint",className:"-rotate-45 text-[12px] leading-[16px]",children:c(e)})},e))]})}),(0,n.jsx)("tbody",{children:a&&(!t||0===t.length)?(0,n.jsx)(j,{}):x?(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:Math.max(u.length+1,1),className:"p-4",children:(0,n.jsx)(m.A,{variant:"body1",children:c("no_search_results")})})}):t.map((e,t)=>{let a=h(e);return(0,n.jsxs)("tr",{className:"border-b border-solid border-black/10 relative",id:e.typeId,role:"row",children:[(0,n.jsx)("td",{className:"min-w-[150px] w-[300px] sticky left-0 bg-white z-10 lg:min-w-[300px]",role:"rowheader",children:(0,n.jsx)(C,{item:e,setSelectedFlavor:l,includeNutritionAnnouncement:!0})}),a.map((e,t)=>(0,n.jsx)("td",{className:r()("text-center",t%2==0&&"bg-secondary-light"),role:"cell","aria-label":"".concat(c(u[t]),": ").concat(e||0),children:(0,n.jsx)("span",{children:e||0})},t))]},t)})})]})})]})},A=e=>{let{filteredItemData:t,setSelectedFlavor:l,loadingItemsData:a,chrome:s,bodyScrollRef:c}=e,{t:d}=(0,i.Bd)("nutrition"),x=!a&&(!t||0===t.length);return(0,n.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 w-full",children:[(0,n.jsx)("div",{className:"flex-shrink-0 relative z-40 bg-white",children:s}),(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",ref:c,children:(0,n.jsxs)("table",{className:"w-full table-auto",role:"table","aria-label":d("allergen_information_table"),children:[(0,n.jsx)("thead",{className:"sticky top-0 z-20 bg-white",children:(0,n.jsxs)("tr",{className:"h-[120px] border-b border-solid border-black/10",role:"row",children:[(0,n.jsx)("th",{className:"sticky left-0 bg-white z-30 min-w-[150px] w-[300px] lg:min-w-[300px]",scope:"col",role:"columnheader","aria-label":d("product_name"),children:(0,n.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,n.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,n.jsx)(o(),{src:w.FI.containsIndicator,alt:d("contains")}),(0,n.jsx)("span",{className:"text-xs",children:d("contains_allergen")})]}),(0,n.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,n.jsx)(o(),{src:w.FI.mayContainIndicator,alt:d("may_contain")}),(0,n.jsx)("span",{className:"text-xs",children:d("ingredients_may_contain")})]}),(0,n.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,n.jsx)(o(),{src:w.FI.tooltip,alt:d("tooltip")}),(0,n.jsx)("span",{className:"text-xs",children:d("tree_nut_type_it_contains",{defaultValue:"Tree nut type it contains"})})]})]})}),N.map(e=>(0,n.jsx)("th",{className:"min-w-[50px] max-w-[50px] text-left whitespace-nowrap bg-white",scope:"col",role:"columnheader",children:(0,n.jsx)(m.A,{variant:"finePrint",className:"-rotate-45 text-[12px] leading-[16
1px]",children:d(e)})},e))]})}),(0,n.jsx)("tbody",{children:a&&(!t||0===t.length)?(0,n.jsx)(j,{}):x?(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:N.length+1,className:"p-4",children:(0,n.jsx)(m.A,{variant:"body1",children:d("no_search_results")})})}):t.map((e,t)=>(0,n.jsxs)("tr",{className:"border-b border-solid border-black/10 relative",id:e.typeId,role:"row",children:[(0,n.jsx)("td",{className:"min-w-[150px] w-[300px] sticky left-0 bg-white z-10 lg:min-w-[300px]",role:"rowheader",children:(0,n.jsx)(C,{item:e,setSelectedFlavor:l})}),_.map((t,l)=>{let a=e.allergyInformation[t],i=e.mayContainAllergyInformation[t],s="treeNut"===t?y.filter(t=>e.allergyInformation[t]||e.mayContainAllergyInformation[t]):[],c=a?d("contains"):i?d("may_contain"):d("does_not_contain"),m="".concat(d(t),": ").concat(c);return(0,n.jsx)("td",{className:r()("min-w-[50px] max-w-[50px] text-center",l%2==0&&"bg-secondary-light"),role:"cell","aria-label":m,children:(0,n.jsx)("div",{className:"flex justify-center",children:(a||i)&&(0,n.jsxs)("div",{className:"relative w-[50px] h-[25px] flex items-center justify-between",children:[(0,n.jsx)(o(),{src:a?w.FI.containsIndicator:w.FI.mayContainIndicator,alt:d(a?"contains":"may_contain"),className:"m-auto"}),s.length>0&&(0,n.jsx)(g,{contains:!!a,nuts:[...s]})]})})},l)})]},t))})]})})]})},C=e=>{let{item:t,setSelectedFlavor:l,includeNutritionAnnouncement:a=!1}=e,{t:r}=(0,i.Bd)("nutrition");return(0,d.useMemo)(()=>{let e=t.type===r("mini_desserts")?r("dessert_mini",{dessert:t.name}):t.name,{nutritionInformation:i}=t,s="";a&&i&&(s=Object.keys(i).filter(e=>i[e]&&"object"==typeof i[e]&&i[e].total).map(e=>{var t,l;return{label:r(e),value:(null==(l=i[e])||null==(t=l.total)?void 0:t.value)||0}}).map(e=>"".concat(e.label,": ").concat(e.value)).join(", "));let c=s?"".concat(e,". ").concat(s,". ").concat(r("click_to_view_details")):"".concat(e,". ").concat(r("click_to_view_details"));return(0,n.jsxs)("button",{type:"button",className:"py-2.5 flex gap-2.5 items-center cursor-pointer hover:bg-primary focus:bg-primary pl-2 rounded-md w-full text-left border-0 bg-transparent",onClick:()=>l(t),"aria-label":c,children:[(0,n.jsx)(o(),{width:45,height:45,src:"".concat(t.image,"?w=45&h=45"),alt:"".concat(e," image")}),(0,n.jsx)("span",{className:"text-sm font-semibold",children:e})]})},[t.image,t.name,t.type,t.nutritionInformation,a,l,r])}},94697:(e,t,l)=>{l.d(t,{A:()=>o});var n=l(37876),a=l(54819),r=l(96092),i=l(76423),s=l(69936);function o(e){let{title:t,children:l}=e;return(0,n.jsx)(a.EN,{children:e=>{let{open:o}=e;return(0,n.jsxs)("div",{className:"border border-gray-20 rounded-xl",children:[(0,n.jsxs)(a.EN.Button,{className:"flex items-center justify-between w-full p-5",children:[(0,n.jsx)(s.A,{variant:"title3",children:t}),o?(0,n.jsx)(i.A,{}):(0,n.jsx)(r.A,{})]}),o&&(0,n.jsxs)(a.EN.Panel,{className:"flex flex-col px-5",children:[(0,n.jsx)("div",{className:"w-full border-t border-gray-200 mb-5"}),(0,n.jsx)("div",{className:"pb-5",children:l})]})]})}})}}}]); 2//# sourceMappingURL=5132-e95bfc711dfbaa31.js.map
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.