PageSourceSearch

https://dinnerly.com.au/funnel/_next/static/chunks/pages/build-your-own-box-b8d23f3f5ff843aa.js

js dinnerly.com.au collected 2026-10-06 15:05:22 UTC 138,871 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[787],{95:(e,t,l)=>{"use strict";l.d(t,{k:()=>a});let a=e=>"bistromd"===e?"signature":"everything"},222:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var a,r=l(4232);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let s=function(e){return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none"},e),a||(a=r.createElement("path",{fill:"#3b382e",d:"M21.861 5.866a.94.94 0 0 0-.666-.335l-.052-.002H7.26a1 1 0 0 1-.984-.821l-.382-2.101a.936.936 0 0 0-.921-.769H2.692a.937.937 0 0 0 0 1.873h1.256c.142 0 .263.101.288.24l.49 2.696s0 .006.002.009l1.787 9.834.022.104q.017.073.038.145c.135.46.106.985-.106 1.416a2.781 2.781 0 1 0 5.278 1.225c0-.453.32-.909.773-.909h1.747c.453 0 .774.456.774.91a2.781 2.781 0 1 0 2.78-2.782H8.89a.54.54 0 0 1-.52-.397l-.01-.046-.036-.196a1 1 0 0 1 .983-1.179h9.264l.105-.002a2.41 2.41 0 0 0 2.268-1.978l1.122-6.168a.93.93 0 0 0-.204-.767m-4.04 12.605a.91.91 0 1 1 0 1.819.91.91 0 0 1 0-1.819m-8.856 0a.91.91 0 1 1 0 1.819.91.91 0 0 1 0-1.819m9.047-5.561H8.77a1.2 1.2 0 0 1-1.181-.987l-.565-3.106A1.2 1.2 0 0 1 8.205 7.4H18.58c.75 0 1.316.68 1.181 1.418l-.567 3.106c-.105.57-.602.985-1.182.985"})))}},881:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var a,r,n=l(4232);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let i=function(e){return n.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),a||(a=n.createElement("path",{stroke:"#101820",strokeLinecap:"round",strokeLinejoin:"round",d:"M4.255 15.745c-.72-.718-.242-2.229-.608-3.113-.38-.913-1.772-1.655-1.772-2.632s1.392-1.719 1.772-2.632c.366-.884-.111-2.395.608-3.113.718-.72 2.23-.242 3.113-.608.917-.38 1.655-1.772 2.632-1.772s1.719 1.392 2.632 1.772c.884.366 2.395-.111 3.113.608.72.718.243 2.229.608 3.113.38.917 1.772 1.655 1.772 2.632s-1.392 1.719-1.772 2.632c-.366.884.111 2.395-.608 3.113-.718.72-2.229.243-3.113.608-.913.38-1.655 1.772-2.632 1.772s-1.719-1.392-2.632-1.772c-.884-.366-2.395.111-3.113-.608"})),r||(r=n.createElement("path",{stroke:"#101820",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 8.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5m5 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5m-5.625-.625 6.25-6.25"})))}},1029:(e,t,l)=>{"use strict";l.d(t,{y:()=>n});var a=l(3105);let r=["ONE","TWO","THREE","FOUR","FIVE","SIX"],n=async e=>{let{plans:t,availableRecipePreferences:l}=(await a.A.gql.user.getPlansAndRecipePreferences(e)).data.data;return{mealkitPlans:t.filter(e=>"RTH"!==e.segment),readyToHeatPlans:t.filter(e=>"RTH"===e.segment),recipePreferences:r.reduce((e,t)=>(e[t]=l.filter(e=>e.numberOfPersons.includes(t)).slice(0,7),e),{})}}},1584:(e,t,l)=>{"use strict";l.d(t,{a:()=>n});var a=l(7876);l(4232);var r=l(9241);let n=({isWhite:e=!1,isTertiary:t=!1})=>(0,a.jsxs)("div",{className:"absolute flex items-center justify-center space-x-1",children:[(0,a.jsx)("div",{style:{animationDelay:"0ms"},className:(0,r.A)("size-2 animate-pulse rounded-full bg-font-primary delay-75",{"bg-neutral-white":e,"bg-tertiary-master":t})}),(0,a.jsx)("div",{style:{animationDelay:"250ms"},className:(0,r.A)("size-2 animate-pulse rounded-full bg-font-primary delay-75",{"bg-neutral-white":e,"bg-tertiary-master":t})}),(0,a.jsx)("div",{style:{animationDelay:"500ms"},className:(0,r.A)("size-2 animate-pulse rounded-full bg-font-primary delay-75",{"bg-neutral-white":e,"bg-tertiary-master":t})})]});n.displayName="Loader"},1784:(e,t,l)=>{"use strict";l.d(t,{_:()=>n});var a=l(7876);l(4232);var r=l(9241);let n=({src:e,alt:t,className:l="",ariaHidden:n})=>(0,a.jsx)("img",{src:e,alt:t,"aria-hidden":n,className:(0,r.A)("w-full",l)})},1875:(e,t,l)=>{"use strict";l.d(t,{d:()=>g});var a=l(7876),r=l(4232),n=l(9099),s=l(3830),i=l(6895),o=l(8062),c=l(1742),d=l(63),u=l(776),p=l(847),m=l(3188),x=l(114);let g=()=>{let{t:e}=(0,o.B)(),t=(0,n.useRouter)(),{state:l,dispatch:g}=(0,r.useContext)(d.BR),{countryLowercase:h,brandShortLowercase:f,locale:v}=(0,p.PB)(),[b,j]=(0,r.useState)(!0),_=(0,m.OY)(v);return(0,a.jsxs)(s.l,{isOpen:b,closeDialog:()=>j(!1),modalId:"resume-on-demand-modal",children:[(0,a.jsxs)("section",{className:"text-center md:mx-4",children:[(0,a.jsx)(i.o5,{component:"h3",variant:"heading-medium-strong",children:e("plan.step_1.resumeOnDemandModal.title")}),(0,a.jsx)(i.o5,{component:"div",variant:"label-small-regular",className:"mt-2 text-neutral-greyDark",children:e("plan.step_1.resumeOnDemandModal.description")}),(0,a.jsx)(c.A,{className:"mx-auto mt-4"})]}),(0,a.jsx)("div",{className:"mt-9 flex justify-center pb-2 md:mx-4",children:(0,a.jsx)(i.$n,{variant:"primary",onClick:()=>
1{if(j(!1),g(d.Te.SetSignupMode({mode:"ON_DEMAND"})),"/build-your-own-box"!==t.pathname)t.push(`/build-your-own-box${window.location.search}`);else{let e=!!(0,x.fE)().get("v")?.trim()||!!l?.visit?.promotionCode?.trim();(0,u.u4)({name:u.qZ["build-your-own-box"],visitId:l.uuid,email:l?.location?.email,country:h,brand:f,snapshot:{...(0,u.vH)(l,_.value),currentUrl:window.document.location.href??"",flow:"on-demand",voucherPreselected:e}})}},"data-testid":"resume-on-demand-cta",children:e("plan.step_1.resumeOnDemandModal.cta")})})]})}},2777:(e,t,l)=>{"use strict";l.d(t,{l:()=>p});var a=l(7876),r=l(4232),n=l(1993),s=l(5094),i=l(9241),o=l(6895),c=l(5112);let d=(e="")=>{let t=e.split(" ");return{boldText:t[0],normalText:t.slice(1).join(" ")}},u=({isDateSelect:e,error:t,inputClassName:l,boldFirstWord:u,isPlaceHolder:p,selectedItem:m,options:x,activeOptionLabelClassName:g,open:h,onOpenChange:f})=>{(0,r.useEffect)(()=>{f?.(h)},[h]);let{brandShort:v}=(0,c.P)();return(0,a.jsxs)("div",{className:(0,i.A)("relative",e?"mt-2":"mt-1"),children:[(0,a.jsxs)(n.WF.Button,{className:(0,i.A)("w-full rounded-input border bg-neutral-white border-neutral-greyDim",e?"block p-4":"relative py-2 pl-3 pr-10 text-left focus:border-neutral-charcoal focus:outline-none focus:ring-2 focus:ring-neutral-greyMaster focus:ring-offset-2",t&&"border-2 border-tertiary-700 dn:border dn:border-tertiary-dark dn:focus:border-tertiary-master",l),children:[u?(0,a.jsxs)("span",{className:(0,i.A)("block truncate",e&&"text-left",p(m)&&"text-neutral-greyDark"),children:[(0,a.jsx)(o.o5,{component:"span",variant:"body-strong",className:"mr-1",children:d(m?.label).boldText}),(0,a.jsx)(o.o5,{component:"span",variant:"body-regular",children:d(m?.label).normalText})]}):(0,a.jsx)(o.o5,{component:"span",variant:"caption1-regular",className:(0,i.A)("block truncate",e&&"text-left",p(m)&&"text-neutral-greyDark"),children:m?.label}),(0,a.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-5",children:(0,a.jsx)("svg",{width:"11",height:"6",viewBox:"0 0 11 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:"MS"!==v?(0,a.jsx)("path",{d:"M5.80371 6L0.607695 -3.29271e-06L11 -2.38419e-06L5.80371 6Z",fill:"#CACECD"}):(0,a.jsx)("path",{d:"M5.1301 5.75896C4.96369 5.75896 4.80309 5.69317 4.68505 5.57514L0.184306 1.07439C-0.0614354 0.828652 -0.0614354 0.430048 0.184306 0.184306C0.430048 -0.0614354 0.82865 -0.0614354 1.07439 0.184306L4.18729 3.2972C4.70799 3.8179 5.55221 3.8179 6.07291 3.2972L9.1858 0.184306C9.43154 -0.0614354 9.83015 -0.0614354 10.0759 0.184306C10.3216 0.430048 10.3216 0.828652 10.0759 1.07439L5.57514 5.57514C5.45711 5.69317 5.2965 5.75896 5.1301 5.75896Z",fill:"currentColor"})})})]}),(0,a.jsx)(s.e,{as:r.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,a.jsx)(n.WF.Options,{className:(0,i.A)("absolute mt-1 max-h-60 w-full overflow-auto rounded-default py-1 text-base shadow-lg ring-1 ring-black/5 z-1 focus:outline-none",e?"bg-neutral-greyUltraLight":"bg-neutral-white"),modal:!1,children:x.map(t=>(0,a.jsx)(n.WF.Option,{disabled:t.disabled,className:({active:l})=>(0,i.A)({[g]:l,"py-1 px-1 cursor-pointer":e,"select-none relative py-2 px-4":!e,"text-neutral-greyMaster bg-neutral-greyLight":t.disabled,"text-neutral-greyDark":p(t)}),value:t,children:({selected:l})=>(0,a.jsx)("div",{className:(0,i.A)(e&&"px-1.5 py-2"),children:(0,a.jsx)("span",{className:(0,i.A)("block cursor-pointer truncate px-1 ",l&&e&&"rounded-input bg-select-active dn:text-font-secondary"),children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.o5,{component:"span",variant:"caption1-strong",className:"mr-1",children:d(t.label).boldText}),(0,a.jsx)(o.o5,{component:"span",variant:"caption1-regular",children:d(t.label).normalText})]}):(0,a.jsx)(o.o5,{component:"span",variant:"caption1-regular",children:t.label})})})},t.value))})})]})},p=({options:e,label:t="",onChange:l,error:s,selectValue:c="",className:d,inputClassName:p,activeOptionLabelClassName:m,isDateSelect:x=!1,boldFirstWord:g=!1,firstOptionIsPlaceholder:h=!1,onOpenChange:f})=>{let[v,b]=r.useState(e[0]),j=t=>h&&t.value===e[0].value;return(0,r.useEffect)(()=>
1{if(c){let[t]=e.filter(e=>`${e.value}`==`${c}`);t&&b(t)}return()=>{}},[]),(0,a.jsxs)("div",{className:(0,i.A)("relative text-font-primary",d),children:[t&&t.length>0&&(0,a.jsx)(o.o5,{className:"ms:text-neutral-greyDark",component:"span",variant:"caption1-regular",children:t}),(0,a.jsx)(n.WF,{value:v,onChange:e=>{b(e),l&&l(e.value)},children:({open:t})=>(0,a.jsx)(u,{open:t,onOpenChange:f,activeOptionLabelClassName:m,isPlaceHolder:j,options:e,selectedItem:v,isDateSelect:x,error:s,inputClassName:p,boldFirstWord:g,firstOptionIsPlaceholder:h})}),s&&(0,a.jsx)(o.o5,{component:"p",variant:"label-xsmall-strong",className:"mt-1 text-tertiary-700 dn:text-tertiary-dark dn:font-regular",children:s})]})}},3492:(e,t,l)=>{"use strict";l.d(t,{A:()=>u});var a,r,n,s,i,o,c=l(4232);function d(){return(d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let u=function(e){return c.createElement("svg",d({xmlns:"http://www.w3.org/2000/svg",width:21,height:38,fill:"none"},e),a||(a=c.createElement("path",{fill:"#febfa4",d:"M16.437 32.912v-9.253H8.354v9.253z"})),r||(r=c.createElement("path",{fill:"#fd8e5f",d:"M17.259 32.913v-2.75H7.573v2.75z"})),n||(n=c.createElement("path",{fill:"#fd8e5f",d:"M16.967 32.86v3.184c0 .905-.735 1.64-1.64 1.64H9.573c-.905 0-1.64-.735-1.64-1.64V32.86z"})),s||(s=c.createElement("path",{fill:"#ff6539",d:"M16.967 36.15v-3.29H7.932z"})),c.createElement("path",{fill:"#ffc2a8",d:"M16.407 29.292v-2.709H8.354v.412z",opacity:.5,style:{mixBlendMode:"multiply"}}),i||(i=c.createElement("path",{fill:"#8058ac",d:"M20.146 8.255c.068-4.05-3.199-7.386-7.297-7.454s-7.475 3.16-7.544 7.21l-.069 4.126a3.126 3.126 0 0 0-4.092.187 3.035 3.035 0 0 0-.073 4.328l2.906 2.968a3.8 3.8 0 0 1 1.087 2.721l-.05 2.999a1.19 1.19 0 0 0 1.18 1.205l12.44.204a1.195 1.195 0 0 0 1.22-1.166z"})),o||(o=c.createElement("path",{fill:"#4c2387",d:"m19.116 23.128-3.03-3.12 3.25-3.082.653.672.011-.661-.324-.334.335-.318.011-.656-.672.638-3.053-3.142 3.333-3.162.479.492.011-.66-.15-.155.155-.147.011-.656-.492.467-3.048-3.137 2.269-2.153a7 7 0 0 0-.28-.38L16.27 5.83l-3.12-3.212 1.62-1.536a8 8 0 0 0-.542-.131l-1.404 1.331-1.34-1.38q-.277.046-.546.111l1.545 1.591L9.15 5.768 6.962 3.516q-.15.182-.29.375l2.137 2.2-3.25 3.082-.269-.277-.02 1.197.276-.261 3.12 3.211-3.175 3.012-3.12-3.212 1.413-1.34a3 3 0 0 0-.643-.036l-1.097 1.04-.495-.509a3 3 0 0 0-.369.293l.525.54-1.49 1.412q-.03.319.01.637l1.806-1.714 3.12 3.212-2.254 2.139.327.334 2.253-2.137 3.048 3.137-3.192 3.029-.273-.281-.02 1.204.28-.265 2.954 3.04.87.015 3.087-2.928 2.941 3.028.851.014 3.08-2.921.767.79.012-.66-.44-.453.455-.431.01-.656zm-.106-6.538-3.25 3.082-3.054-3.142 3.25-3.083zm-6.63-.395-3.048-3.137 3.25-3.083 3.049 3.137zm6.924-6.568-3.333 3.162-3.049-3.137 3.334-3.162zM12.81 2.942l3.12 3.212-3.333 3.162-3.12-3.211zM5.887 9.51l3.25-3.083 3.12 3.212-3.25 3.083zm-.069 6.881 3.176-3.011 3.048 3.137-3.176 3.012zm2.896 9.967L5.66 23.216l3.193-3.029 3.053 3.142zm.479-6.493 3.175-3.012 3.053 3.142-3.175 3.012zm6.41 6.596-3.03-3.119 3.174-3.011 3.03 3.119z"})))}},3830:(e,t,l)=>{"use strict";l.d(t,{l:()=>d});var a=l(7876);l(4232);var r=l(5094),n=l(6655),s=l(6895),i=l(2510),o=l(8062),c=l(9241);let d=({title:e,isOpen:t,closeDialog:l,modalId:d,children:u,dialogMaxWidthClassName:p="max-w-2xl",noPadding:m=!1,hideCloseButton:x=!1})=>{let{t:g}=(0,o.B)();return(0,a.jsx)(r.e,{show:t,enter:"transition duration-100 ease-out",enterFrom:"scale-95 opacity-0",enterTo:"scale-100 opacity-100",leave:"transition duration-75 ease-out",leaveFrom:"scale-100 opacity-100",leaveTo:"scale-95 opacity-0",children:(0,a.jsx)(n.lG,{open:t,className:"fixed inset-0 z-[10001] overflow-y-auto",onClose:l,children:(0,a.jsxs)("div",{className:"flex min-h-screen items-start justify-center",children:[(0,a.jsx)(n.Xi,{className:"fixed inset-0 bg-neutral-charcoal opacity-70"}),(0,a.jsxs)("div",{className:(0,c.A)("w-full absolute bottom-0 overflow-hidden rounded-t-xl bg-neutral-white align-middle shadow-xl transition-all lg:relative lg:my-auto lg:rounded-2xl",p,{"p-4 lg:p-10":!m,"pt-0":m}),id:d,children:[x?(0,a.jsx)("div",{className:"h-6 lg:hidden"}
1):(0,a.jsx)("div",{className:(0,c.A)("flex justify-end",{"py-4 px-4 pb-1":m}),children:(0,a.jsx)("button",{"aria-label":g("spree.close"),type:"button",onClick:l,className:"flex size-6 items-center justify-center rounded-full border-0",children:(0,a.jsx)(i.I,{icon:"close",className:"text-xl"})})}),e&&(0,a.jsx)(s.o5,{component:"h3",variant:"title1",ariaLabel:e,children:e}),(0,a.jsx)("div",{children:u})]})]})})})}},4124:(e,t,l)=>{"use strict";l.d(t,{c:()=>c,m:()=>o});var a=l(3422),r=l.n(a),n=l(1266),s=l(5270);let i="funnel_on_demand_eligible",o=()=>{try{(0,s.M)()?localStorage.setItem(i,"true"):r().set(null,i,"true",{maxAge:n.T.max_cookie_age,path:"/"})}catch(e){}},c=()=>{try{return(0,s.M)()?"true"===localStorage.getItem(i):"true"===(0,a.parseCookies)()[i]}catch(e){return!1}}},5678:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/build-your-own-box",function(){return l(8523)}])},5847:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var a,r=l(4232);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let s=function(e){return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none"},e),a||(a=r.createElement("path",{fill:"currentColor",d:"M7.987 1.951c.345 0 .624.28.624.624V6.03c0 .737.597 1.334 1.333 1.334h3.454a.624.624 0 0 1 0 1.248H9.944c-.736 0-1.333.597-1.333 1.333v3.454a.624.624 0 1 1-1.248 0V9.944c0-.736-.597-1.333-1.334-1.333H2.575a.624.624 0 0 1 0-1.248H6.03c.737 0 1.334-.597 1.334-1.334V2.575c0-.345.279-.624.624-.624"})))}},5933:(e,t,l)=>{"use strict";l.d(t,{Go:()=>p,L8:()=>u,Oe:()=>c,_j:()=>m,hK:()=>x});var a=l(1266),r=l(8145),n=l.n(r),s=l(114),i=l(2602);let o=e=>!!e?.Error,c=async e=>{let t=new FormData;t.append("Key",a.T.LOQATE_API_KEY),t.append("Id",e);try{let e=(await n().post(i.IP,t)).data.Items[0];if(e&&o(e))throw Error(e.Description);return e}catch(e){(0,s.LM)("Loqate address retrieve error",{error:e instanceof Error?e.message:"Error unknown"});return}},d=async(e,t)=>{let l=new FormData;l.append("Key",a.T.LOQATE_API_KEY),l.append("Text",`${e} ${t.iso}`),l.append("IsMiddleware","false"),l.append("Origin",t.iso),l.append("Countries",t.iso),l.append("Filters","Postcode:"+e),l.append("Limit","5");let r=await n().post(i.z9,l);for(let e of r.data.Items){if(o(e))throw Error(e.Description);if("Address"===e.Type)return e}return r.data.Items[0]},u=(e,t,l,r="1")=>{let s=new FormData;return s.append("Key",a.T.LOQATE_API_KEY),s.append("Text",t),s.append("IsMiddleware","false"),s.append("Origin",l.iso),s.append("Countries",l.iso),s.append("Container",e),s.append("Limit",r),n().post(i.z9,s)},p=e=>i.AK.some(t=>t===e.CountryIso2.toUpperCase())?e.Street:e.Line1,m=async(e,t)=>{try{let l=await d(e,t),a=0;for(;l&&"Address"!==l.Type&&a<5;){a+=1;let r=(await u(l.Id,e,t)).data.Items[0];if(!r||o(r))return;l=r}if(!l||"Address"!==l.Type)return;let r=await c(l.Id),n=r?.ProvinceCode||"",s=e.split(" ")[0].split("-")[0];if(!n||!r?.PostalCode.includes(s))return;return n}catch{return}},x=98},6608:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var a,r=l(4232);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let s=function(e){return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:14,height:14,x:218,y:182,fill:"#b1adab"},e),a||(a=r.createElement("path",{fill:"#2d2926",fillRule:"evenodd",d:"M5.956 7 .21 1.253A.74.74 0 0 1 .216.216.73.73 0 0 1 1.253.21L7 5.956 12.747.21a.74.74 0 0 1 1.037.006c.29.29.29.753.006 1.037L8.044 7l5.746 5.747c.28.28.282.748-.006 1.037a.73.73 0 0 1-1.037.006L7 8.044 1.253 13.79a.74.74 0 0 1-1.037-.006.73.73 0 0 1-.006-1.037z"})))}},6983:(e,t,l)=>{"use strict";l.d(t,{A:()=>i});var a,r,n=l(4232);function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let i=function(e){return n.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:14,height:14,fill:"none"},e),a||(a=n.createElement("path",{fill:"currentColor",d:"M8.684 4.684a.627.627 0 0 1 .886.886l-3.5 3.5a.627.627 0 0 1-.886 0l-1.5-1.5a.627.627 0 0 1 .886-.886l.586.585c.26.26.682.26.942 0z"})),r||(r=n.createElement("path",{fill:"currentColor",d:"M12 6.627a5.373 5.373 0 1 0-10.746 0 5.373 5.373 0 0 0 10.746 0m1.254 0A6.627 6.627 0 1 1 0 6.627a6.627 6.627 0 0 1 13.254 0"})))}},7582:(e,t,l)=>{"use strict";l.d(t,{A:()=>c});var a,r,n,s,i=l(4232);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let c=function(e){return i.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",width:40,height:40,fill:"none"},e),a||(a=i.createElement("path",{fill:"#ff0",d:"M32.819 6.76v20.656c0 .857-.697 1.553-1.556 1.553H9.392a1.4 1.4 0 0 1-1.4-1.398v-19.6a2.767 2.767 0 0 1 2.768-2.764h20.503c.86 0 1.555.695 1.555 1.553"})),r||(r=i.createElement("g",{clipPath:"url(#a)"},i.createElement("path",{fill:"#3b382e",d:"M26.29 24.304c.876 0 1.63-1.67 1.63-3.196 0-.936-.225-1.506-.754-1.954-.366-.305-.509-.59-.448-1.405l.57-6.615c.061-.814-.326-1.283-.997-1.283-.672 0-1.059.469-.998 1.283l.57 6.615c.061.815-.081 1.1-.448 1.405-.529.448-.753 1.018-.753 1.954 0 1.527.753 3.196 1.629 3.196m-8.06.02c.407 0 .672-.204.794-.773l1.506-6.88c.061-.306.224-.408.387-.408s.285.122.285.428l.102 3.847c.04 1.608-.143 1.791-.774 2.137-.326.183-.448.407-.448.733 0 .489.285.814.896.814h2.524c.61 0 .896-.346.896-.834 0-.326-.122-.53-.448-.713-.631-.346-.753-.529-.814-2.117l-.265-7.144c-.04-1.222.04-1.364.57-1.71.407-.265.59-.55.59-.998s-.285-.732-.936-.732h-1.893c-.59 0-.774.203-.896.753l-1.669 7.43c-.061.264-.183.407-.407.407s-.346-.143-.407-.408l-1.67-7.43c-.121-.549-.305-.752-.895-.752h-1.893c-.651 0-.936.284-.936.732s.183.733.59.998c.53.346.61.488.57 1.71l-.265 7.144c-.06 1.588-.183 1.771-.814 2.117-.326.183-.448.387-.448.713 0 .488.285.834.896.834h2.524c.61 0 .896-.325.896-.814 0-.326-.122-.55-.448-.733-.631-.346-.814-.529-.774-2.137l.102-3.847c0-.305.122-.428.285-.428s.326.102.387.407l1.506 6.88c.122.57.387.774.794.774"}))),n||(n=i.createElement("path",{fill:"#3b382e",d:"M32.889 30.691h.122a.62.62 0 0 0 .62-.62V4.995a.62.62 0 0 0-.62-.62H10.316A4.063 4.063 0 0 0 6.25 8.436v23.653a4.063 4.063 0 0 0 4.066 4.06H28.38v.008h5.041a.31.31 0 0 0 .31-.31v-.681a.31.31 0 0 0-.31-.31h-.533a.93.93 0 0 1-.93-.93V31.62a.93.93 0 0 1 .93-.93M7.554 8.436a2.76 2.76 0 0 1 2.762-2.759h20.46c.857 0 1.552.694 1.552 1.55v20.612c0 .856-.695 1.55-1.552 1.55H8.95a1.396 1.396 0 0 1-1.396-1.395zm0 23.653v-.003c0-.77.625-1.395 1.396-1.395h20.7
173a.93.93 0 0 1 .931.93v2.297a.93.93 0 0 1-.931.93H10.316a2.76 2.76 0 0 1-2.762-2.76"})),s||(s=i.createElement("defs",null,i.createElement("clipPath",{id:"a"},i.createElement("path",{fill:"#fff",d:"M12.062 9.851H27.92v14.473H12.062z"})))))}},8523:(e,t,l)=>{"use strict";l.r(t),l.d(t,{__N_SSP:()=>ls,default:()=>li});var a=l(7876),r=l(9099),n=l(4232),s=l(1867),i=l(423),o=l(847),c=l(1992),d=l(680),u=l(95),p=l(9241),m=l(7445),x=l(9428),g=l(6895),h=l(5094),f=l(6655),v=l(5203);let b=({isOpen:e,modalId:t,children:l})=>(0,a.jsx)(h.e,{show:e,enter:"transition duration-100 ease-out",enterFrom:"scale-95 opacity-0",enterTo:"scale-100 opacity-100",leave:"transition duration-75 ease-out",leaveFrom:"scale-100 opacity-100",leaveTo:"scale-95 opacity-0",children:(0,a.jsx)(f.lG,{open:e,className:"fixed inset-0 z-[10001] overflow-y-auto",onClose:()=>void 0,children:(0,a.jsxs)("div",{className:"flex min-h-screen items-start justify-center",children:[(0,a.jsx)(f.Xi,{className:"fixed inset-0 bg-neutral-charcoal opacity-70"}),(0,a.jsxs)("div",{className:"absolute bottom-0 flex size-full max-h-screen flex-col bg-neutral-white align-middle shadow-xl transition-all lg:relative lg:my-auto lg:max-w-2xl lg:rounded-2xl",id:t,children:[(0,a.jsx)("div",{className:"flex shrink-0 items-end justify-between px-4 pt-4 lg:px-12 lg:pt-12",children:(0,a.jsx)(v.A,{})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-4 lg:px-12",children:l})]})]})})}),j=(e,t)=>{let l=e.find(e=>e.name===(0,u.k)(t));return{id:l.id,name:l.name}};var _=l(3905),y=l(7032),w=l(63),N=l(6667),C=l(52),P=l(8062),E=l(776),A=l(2694);let k=(e,t)=>{switch(t.type){case"ADD_ITEM":{let{itemType:l,item:a,quantity:r}=t.payload,n="RECIPE"===l?"recipes":"addOns";e[n][a.id]||(e[n][a.id]={...a,amount:0}),e[n][a.id].amount+=r,e.itemsInitialized=!0;break}case"REMOVE_ITEM":{let{itemType:l,itemId:a,quantity:r}=t.payload,n="RECIPE"===l?"recipes":"addOns",s=e[n][a];s&&(s.amount-=r,s.amount<=0&&delete e[n][a]);break}case"CLEAR_ITEM":{let{itemType:l,itemId:a}=t.payload;delete e["RECIPE"===l?"recipes":"addOns"][a];break}case"SYNC_RECIPE_PRICES":t.payload.recipes.forEach(({id:t,pricePerPortion:l})=>{let a=e.recipes[t];a&&a.pricePerPortion!==l&&(a.pricePerPortion=l)});break;case"CLEAR_CART":e.recipes={},e.addOns={}}},O=(e,t)=>t?Math.round(e/t):0,S=(0,n.createContext)({shoppingCart:A.s8,hasItems:!1,addItem:()=>{},removeItem:()=>{},clearItem:()=>{},clearCart:()=>{},boxSettings:void 0,isBoxSettingsModalOpen:!1,boxSettingsModalMode:"default",openBoxSettingsModal:()=>{},closeBoxSettingsModal:()=>{},isBoxNumberOfPeopleModalOpen:!1,pendingAddToCart:null,openBoxNumberOfPeopleModal:()=>{},closeBoxNumberOfPeopleModal:()=>{},confirmBoxNumberOfPeople:()=>{},addBundleRecipes:()=>{},syncRecipePrices:()=>{}}),L=()=>"true"===sessionStorage.getItem("funnel_shopping_cart_has_tracked_first_item_added_to_cart"),I=(e,t,l,a)=>{(0,E.u4)({name:E.tL.cartFirstItemAdded,visitId:e,country:t,brand:l,snapshot:{flow:(0,E.Qe)(a)}}),sessionStorage.setItem("funnel_shopping_cart_has_tracked_first_item_added_to_cart","true")},T=({children:e,boxSettings:t,recipePreferences:l,onBundleAdded:r})=>{let[s,d]=(0,N.A)(k,A.s8,A.SP),{state:u,dispatch:p,buildYourOwnBoxModalLess:m}=(0,n.useContext)(i.B),{brand:x,countryLowercase:g,brandShortLowercase:h}=(0,o.PB)(),f=Object.keys(s.recipes).length>0||Object.keys(s.addOns).length>0,{isBoxSettingsModalOpen:v,boxSettingsModalMode:b,openBoxSettingsModal:C,closeBoxSettingsModal:P}=(()=>{let[e,t]=(0,n.useState)(!1),[l,a]=(0,n.useState)("default");return{isBoxSettingsModalOpen:e,boxSettingsModalMode:l,openBoxSettingsModal:e=>{a(e?.mode||"default"),t(!0)},closeBoxSettingsModal:()=>{t(!1),a("default")}}})(),{isBoxNumberOfPeopleModalOpen:E,pendingAddToCart:O,openBoxNumberOfPeopleModal:T,closeBoxNumberOfPeopleModal:D,setPendingAddToCart:M}=(()=>{let[e,t]=(0,n.useState)(!1),[l,a]=(0,n.useState)(null);return{isBoxNumberOfPeopleModalOpen:e,pendingAddToCart:l,openBoxNumberOfPeopleModal:e=>{a(e),t(!0)},closeBoxNumberOfPeopleModal:()=>{t(!1),a(null)},setPendingAddToCart:a}})(),B=()=>{d({type:"CLEAR_CART"})};(0,n.useEffect)(()=>{(0,A.Lx)(s)},[s]);let{isLoading:R,validWeekSelection:z,validRecipePreferenceSelection:F,deliveryWeekSuggestion:V}=((e,t)=>{var l,a,r;let s,o,d,{state:u}=(0,n.useContext)(i.B),{locale:p}=u,m=1===t?"RTH":"RTC",{data:x,isLoading:g}
1=(0,c.useQuery)((0,_.jd)(u.uuid,u.location?.zipcode||"","",m),()=>(0,_.sC)(u.uuid,u.location?.zipcode||"",p,"",m),{keepPreviousData:!1,enabled:!!(u.location?.zipcode&&t)}),{validWeekSelection:h,validRecipePreferenceSelection:f,deliveryWeekSuggestion:v}=g?{validWeekSelection:null,validRecipePreferenceSelection:null,deliveryWeekSuggestion:null}:(l=u.boxSettings??null,a=u.recipePreferences??null,s=(r=x??null)&&l&&!!r.find(e=>e.from===l.deliveryWeek),o=t&&e[y.Ko[t]]&&a?.length?a.every(l=>e[y.Ko[t]].some(e=>e.id===l)):null,d=!1===s?r?.[0]?.from??null:null,{validWeekSelection:s,validRecipePreferenceSelection:o,deliveryWeekSuggestion:d});return{isLoading:g,validWeekSelection:h,validRecipePreferenceSelection:f,deliveryWeekSuggestion:v}})(l,t?.numberOfPeople??null);return(0,n.useEffect)(()=>{if(!v&&!R){if(!u.boxSettings&&!m)return void C({mode:m&&!s.itemsInitialized?"recipe-preferences-only":"default"});if((!1===z||!1===F)&&u.boxSettings){if(!z&&f&&B(),!z&&V&&p(w.Te.UpdateBoxSettings({numberOfPeople:u.boxSettings.numberOfPeople,deliveryWeek:V})),!F){let e=l[y.Ko[u.boxSettings.numberOfPeople]];p(w.Te.UpdateRecipePreferences([j(e,x)]))}C()}}},[R]),(0,a.jsx)(S.Provider,{value:{shoppingCart:s,hasItems:f,addItem:(e,l)=>{if(!t){if(!m)return void C();if("RECIPE"===e)return void T({itemType:e,items:[l]})}f||L()||I(u.uuid,g,h,u.signupMode);let a="RECIPE"===e&&t?.numberOfPeople?t.numberOfPeople:1;d({type:"ADD_ITEM",payload:{itemType:e,item:l,quantity:a}})},removeItem:(e,l)=>{let a="RECIPE"===e&&t?.numberOfPeople?t.numberOfPeople:1;d({type:"REMOVE_ITEM",payload:{itemType:e,itemId:l,quantity:a}})},clearItem:(e,t)=>{d({type:"CLEAR_ITEM",payload:{itemType:e,itemId:t}})},clearCart:B,boxSettings:t,isBoxSettingsModalOpen:v,boxSettingsModalMode:b,openBoxSettingsModal:C,closeBoxSettingsModal:P,isBoxNumberOfPeopleModalOpen:E,pendingAddToCart:O,openBoxNumberOfPeopleModal:T,closeBoxNumberOfPeopleModal:D,confirmBoxNumberOfPeople:(e,t,a)=>{p(w.Te.UpdateBoxSettings({numberOfPeople:e,deliveryWeek:t}));let r=l[y.Ko[e]],n=u.recipePreferences?.[0],s=null!=n&&r?.find(e=>e.id===n),i=s?{id:s.id,name:s.name}:j(r,x);p(w.Te.UpdateRecipePreferences([i])),setTimeout(()=>{if(O&&a&&a.length>0){f||L()||I(u.uuid,g,h,u.signupMode);let t="RECIPE"===O.itemType&&e?e:1;a.forEach(e=>{d({type:"ADD_ITEM",payload:{itemType:O.itemType,item:e,quantity:t}})})}M(null),D()},1)},addBundleRecipes:e=>{if(0===e.length)return;let l=t?.numberOfPeople;l?(f||L()||I(u.uuid,g,h,u.signupMode),e.forEach(e=>{d({type:"ADD_ITEM",payload:{itemType:"RECIPE",item:e,quantity:l}})}),r()):T({itemType:"RECIPE",items:e})},syncRecipePrices:e=>{0!==e.length&&d({type:"SYNC_RECIPE_PRICES",payload:{recipes:e}})}},children:e})},D=()=>{let e=(0,n.useContext)(S),{getMaxPortions:t}=(0,C.N)(),{t:l,stringifyTranslation:a}=(0,P.B)(),r=e.boxSettings?.numberOfPeople??2,s=Object.values(e.shoppingCart.recipes).reduce((e,t)=>e+t.amount,0),i=Object.values(e.shoppingCart.addOns).reduce((e,t)=>e+t.amount,0),o=t(r),c=!!(o&&s>o),d=c?a(l("api.errors.order_price.max_portions_reached.web",{value:o})):void 0;return{...e,itemCount:O(s,r)+i,hasError:c,errorMessage:d}};var M=l(114),B=l(449),R=l(1266),z=l(819);let F=({selectedRecipePreference:e,recipePreferences:t,onSelect:l})=>{let r=t=>e?.id===t,{brandShortLowercase:s,brand:i}=(0,o.PB)(),{t:c}=(0,P.B)(),d=`${R.T.BASE_PREFIX_FUNNEL}/images/recipes_icons/${s}`,u=`${d}/not_found.svg`;return(0,n.useEffect)(()=>{e||l(j(t,i))},[]),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 lg:grid-cols-3",children:t.map(e=>(0,a.jsx)("div",{className:"h-full",children:(0,a.jsxs)("label",{className:(0,p.A)("parent_with_focus_child flex h-full min-h-20 cursor-pointer flex-col items-start gap-1 rounded-md border p-4 text-left hover:bg-neutral-50","has-[:focus-visible]:[outline:-webkit-focus-ring-color_auto_1px]",{"border-neutral-700 bg-neutral-75":r(e.id),"border-neutral-200 bg-neutral-00":!r(e.id)}),htmlFor:`${e.id}`,children:[(0,a.jsx)("input",{className:"sr-only",type:"radio",id:`${e.id}`,checked:r(e.id),onChange:()=>l({id:e.id,name:e.name})}),(0,a.jsx)("img",{src:`${d}/${e.name}.svg`,alt:"","aria-hidden":"true",className:"size-8 md:size-auto",onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src=u}}),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)(g.o5,{component:"p",variant:"label-small-strong",children:e.title})})]})},e.id))}),e?.name==="no_added_gluten"&&(0,a.jsxs)(g.o5,{variant:"label-small-regular",className:"mt-4 flex items-center gap-1 text-neutral-700",children:[(0,a.jsx)(z.s,{fillColorClass:"fill-current"}),c("javascript.plan.select_plan.box_settings_modal.no_added_gluten_disclaimer")]})]})},V=({section:e})=>(0,a.jsx)(g.UM,{section:e}),$=(e,t)=>(0,x.GP)((0,m.H)(e),"EEE",{locale:t}),H=({weekdays:e,locale:t})=>(0,a.jsx)(g.o5,{component:"span",variant:"label-xsmall-regular",className:"text-neutral-700",children:1===e.length?$(e[0],t):`${$(e[0],t)} - ${$(e[e.length-1],t)}`}),U=({weeks:e,selectedWeek:t,onSelectWeek:l,onClose:r,hideHeader:s=!1,children:i})=>{let{country:c}=(0,o.PB)(),d=(0,B.J)({country:c}),{t:u}=(0,P.B)();return((0,n.useEffect)(()=>{e&&e.length>0&&!t&&l(e[0].from)},[e]),e)?(0,a.jsxs)("div",{className:s?void 0:"p-4",children:[s?null:(0,a.jsxs)("div",{className:(0,p.A)("mb-4 flex items-center space-x-3",{"cursor-pointer":r}),onClick:r,onKeyDown:r?e=>{("Enter"===e.key||" "===e.key)&&r()}:void 0,role:r?"button":void 0,tabIndex:r?0:void 0,"aria-expanded":!!r||void 0,"aria-label":r?u("spree.close"):void 0,children:[(0,a.jsx)(V,{section:"week"}),(0,a.jsx)(g.o5,{component:"h2",variant:"label-medium-strong",children:u("javascript.plan.select_plan.week_selector.title")})]}),e&&e.length>0&&(0,a.jsx)("div",{className:(0,p.A)("grid grid-cols-3 gap-2",{"md:flex md:flex-nowrap":e.length<=6,"md:grid-cols-5":e.length>6}),children:e.map(e=>{let r,n;return(0,a.jsx)(g.m_,{label:(r=(0,m.H)(e.from),n=(0,x.GP)(r,"MMM d",{locale:d}),(0,a.jsxs)("div",{className:"flex flex-col items-center w-full",children:[(0,a.jsx)(g.o5,{component:"span",variant:"label-xsmall-regular",className:"text-neutral-700",children:u("javascript.plan.select_plan.week_selector.from_date")}),(0,a.jsx)(g.o5,{component:"span",variant:"label-small-strong",children:n}),(0,a.jsx)(H,{weekdays:e.availableWeekdays,locale:d})]})),isSelected:t===e.from,onClick:()=>l(e.from)},e.from)})}),e&&0===e.length&&(0,a.jsx)(g.o5,{component:"p",variant:"body-medium-regular",className:"text-neutral-700",children:u("javascript.plan.select_plan.week_selector.no_delivery")}),i]}):s?(0,a.jsxs)(g.o5,{component:"p",variant:"body-regular",className:"text-neutral-greyMedium",children:[u("spree.loading"),"…"]}):(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(V,{section:"week"}),(0,a.jsxs)(g.o5,{component:"h2",variant:"body-regular",className:"text-neutral-greyMedium",children:[u("spree.loading"),"…"]})]})})};var W=l(1584),K=l(2777);let q=()=>{let{t:e}=(0,P.B)();return(0,a.jsxs)("div",{className:"mt-2 flex w-full items-center gap-1 rounded-input border border-neutral-100 bg-neutral-greyUltraLight py-2 pl-4 pr-2",children:[(0,a.jsx)(z.s,{fillColorClass:"fill-current",classNames:"w-4 h-4 text-neutral-charcoal"}),(0,a.jsx)(g.o5,{component:"p",variant:"caption2-regular",children:e("javascript.plan.step_2.suburbs.disclaimer")})]})},Q=({suburbs:e,selectedSuburb:t,onSelectSuburb:l,postalCode:r})=>{let{t:n}=(0,P.B)();return(0,a.jsx)(K.l,{onChange:l,options:[{label:n("javascript.plan.select_plan.box_settings_modal.choose_suburb"),value:"",disabled:!1},...e.map(e=>({label:e,value:e,disabled:!1}))],selectValue:t,labelSize:"small",inputClassName:"h-12 py-[14px]",activeOptionLabelClassName:"dn:!text-font-primary bg-secondary-ultraLight",firstOptionIsPlaceholder:!0},`suburb-select-${r}`)},Y=({suburbs:e,selectedSuburb:t,onSelectSuburb:l,postalCode:r})=>{let{countryLowercase:s,brandShortLowercase:i}=(0,o.PB)(),{state:c}=(0,n.useContext)(w.BR);return(0,n.useEffect)(()=>{(0,E.u4)({name:E.tL.partiallyDeliverablePostcodeModalShown,visitId:c?.uuid,email:c?.location?.email,country:s,brand:i,snapshot:{zipcode:r}})},[]),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(q,{}
1),(0,a.jsx)(Q,{postalCode:r,suburbs:e,selectedSuburb:t,onSelectSuburb:l})]})},Z=()=>{let{country:e}=(0,o.PB)();return{formatPostalCode:t=>{let l=t;return"NL"!==e&&(l=l.replace(/[^0-9]/g,""),"US"===e||"DE"===e?l=l.slice(0,5):("AU"===e||"BE"===e||"AT"===e)&&(l=l.slice(0,4))),l},isValid:t=>(0,M.aM)(t,e),country:e}},X=n.forwardRef(({postalCode:e,onPostalCodeChange:t,selectedSuburb:l,onSuburbChange:r,showError:s,errorMessage:i,autoFocus:d,showSuburbs:u=!0,showLabel:m=!1,onSubmit:x},h)=>{let{t:f}=(0,P.B)(),{country:v}=(0,o.PB)(),{state:b,dispatch:j}=(0,n.useContext)(w.BR),_=(0,n.useRef)(null),y=(0,n.useCallback)(e=>{_.current=e,"function"==typeof h?h(e):h&&(h.current=e)},[h]),N=n.useId(),{formatPostalCode:C,isValid:E}=Z(),A=E(e),{data:k,isLoading:O}=(0,c.useQuery)(`zipcodeLookup-${e}`,()=>(0,M.kW)(e,b.locale),{enabled:"AU"===v&&A&&u}),S=k?.suburbs??[];return(0,n.useEffect)(()=>{d&&_.current&&_.current.focus()},[d]),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:N,className:(0,p.A)({"sr-only":!m}),children:(0,a.jsx)(g.o5,{variant:"label-small-regular",className:"mb-1 text-neutral-700",children:f("javascript.plan.step_2.zipcode.label")})}),(0,a.jsx)("input",{id:N,ref:y,type:"text",placeholder:f("javascript.plan.step_2.zipcode.placeholder"),value:e,onChange:l=>{let a=C(l.target.value);"AU"===v&&a!==e&&b.delivery?.deliveryDetails?.city&&(j(w.Te.UpdateLocationAndDeliveryDetails({deliveryDetails:{city:""}})),r("")),t(a)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),x())},className:(0,p.A)("min-h-12 w-full rounded-md border bg-neutral-00 p-4 placeholder:text-neutral-700 focus:outline-none focus:ring-1 focus:ring-neutral-700",{"border-tertiary-veryDark":s,"border-neutral-200":!s})}),s&&(0,a.jsx)(g.o5,{variant:"caption2-strong",className:"mt-1 text-tertiary-veryDark",children:i||f("delivery_zips.query_form.validation.minlength")}),O&&(0,a.jsx)("div",{className:"flex justify-center pb-4 pt-6",children:(0,a.jsx)(W.a,{})}),u&&!O&&S.length>0&&(0,a.jsx)(Y,{postalCode:e,suburbs:S,selectedSuburb:l,onSelectSuburb:t=>{r(t),j(w.Te.UpdateLocationAndDeliveryDetails({deliveryDetails:{city:t,postCode:e}}))}})]})});X.displayName="ZipCodeField";var G=l(881),J=l(9883),ee=l(3188);let et=()=>{let{isMarley:e}=(0,o.PB)();return e?(0,a.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{d:"M4.47012 20.9999H19.5301C21.0701 20.9999 22.0301 19.3299 21.2601 17.9999L13.7301 4.98993C12.9601 3.65993 11.0401 3.65993 10.2701 4.98993L2.74012 17.9999C1.97012 19.3299 2.93012 20.9999 4.47012 20.9999Z",fill:"#F0B52B"}),(0,a.jsx)("path",{d:"M11 11V13C11 13.5523 11.4477 14 12 14C12.5523 14 13 13.5523 13 13V11C13 10.4477 12.5523 10 12 10C11.4477 10 11 10.4477 11 11Z",fill:"#19232D"}),(0,a.jsx)("path",{d:"M13 17C13 16.4477 12.5523 16 12 16C11.4477 16 11 16.4477 11 17C11 17.5523 11.4477 18 12 18C12.5523 18 13 17.5523 13 17Z",fill:"#19232D"})]}):(0,a.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{d:"M4.47012 20.9999H19.5301C21.0701 20.9999 22.0301 19.3299 21.2601 17.9999L13.7301 4.98993C12.9601 3.65993 11.0401 3.65993 10.2701 4.98993L2.74012 17.9999C1.97012 19.3299 2.93012 20.9999 4.47012 20.9999Z",fill:"#5833A2"}),(0,a.jsx)("path",{d:"M11 11V13C11 13.5523 11.4477 14 12 14C12.5523 14 13 13.5523 13 13V11C13 10.4477 12.5523 10 12 10C11.4477 10 11 10.4477 11 11Z",fill:"white"}),(0,a.jsx)("path",{d:"M13 17C13 16.4477 12.5523 16 12 16C11.4477 16 11 16.4477 11 17C11 17.5523 11.4477 18 12 18C12.5523 18 13 17.5523 13 17Z",fill:"white"})]})};var el=l(3105),ea=l(5112),er=l(8510),en=l(9014);let es=({personsLabel:e,isLoading:t,listedPortionPrice:l,discountedPortionPrice:r,mobileLayout:s})=>{let{state:o}=(0,n.useContext)(i.B),{locale:c}=(0,ea.P)(),d=(0,ee.OY)(c),{t:u}=(0,P.B)(),m=(0,er.bP)(o.signupMode);return(0,a.jsxs)("div",{className:(0,p.A)({"flex flex-col gap-1 items-center w-full":"grid"===s,"flex lg:flex-col items-center gap-1 w-full justify-between":"list"===s}),children:[(0,a.jsx)(g.o5,{variant:"label-small-strong",children:e}),!m&&(0,a.jsxs)(a.Fragment,{children:[t&&(0,a.jsx)(g.Xb,{className:"h-[28px] w-[120px]"}),!t&&l&&(0,a.jsxs)(g.o5,{className:"text-neutral-700",variant:"label-xsmall-regular",children:[u("javascript.plan.select_plan.box_settings_modal.price.from")," ",(0,a.jsx)(g.o5,{component:"span",className:(0,p.A)("text-neutral-700",r&&"line-through"),variant:r?"label-xsmall-regular":"label-xsmall-strong",children:(0,ee.Cv)(l,d.value,d.locale)})," ",r&&(0,a.jsx)(g.o5,{component:"span",variant:"label-xsmall-strong",children:(0,ee.Cv)(r,d.value,d.locale)})," ",u("javascript.plan.select_plan.box_settings_modal.price.per_portion")]})]})]})},ei=({personsNumber:e,isSelected:t,onClick:l,mobileLayout:r})=>{let s,{t:o,stringifyTranslation:c}=(0,P.B)(),{getListedPortionPrice:d,isLoading:u}=(0,C.N)(),p=1===e?"javascript.plan.select_plan.box_settings_modal.number_people":"javascript.plan.select_plan.box_settings_modal.number_people_plural",m=d(e),{state:x}=(0,n.useContext)(i.B),h=(0,en.z)(x);if(h&&m){let{currentDiscount:t,type:l}=(0,J.ke)({numberOfPeople:e,promo:h});"percentage"===l&&(s=m-m*t/100)}return(0,a.jsx)(g.m_,{label:(0,a.jsx)(es,{personsLabel:c(o(p,{count:e})),listedPortionPrice:m,discountedPortionPrice:s,isLoading:u,mobileLayout:r}),isSelected:t,onClick:l})};var eo=l(6522);let ec=({className:e})=>{let{t}=(0,P.B)(),{state:l}=(0,n.useContext)(w.BR),{countryLowercase:r,brandShortLowercase:s,locale:i}=(0,o.PB)(),c=(0,ee.OY)(i),d=(0,en.z)(l),{currentDiscount:u,freeShipping:m,detailedValueProposition:x}=d?.valid?(0,J.ke)({numberOfPeople:l.boxSettings?.numberOfPeople||0,promo:d}):{currentDiscount:0,freeShipping:!1};return((0,n.useEffect)(()=>
1{d?.valid&&(u||m)&&(0,E.u4)({name:E.tL.boxSettingsVoucherAppliedViewed,visitId:l.uuid,country:r,brand:s,snapshot:{detailedValueProposition:!!x}})},[d?.valid]),d?.valid&&(u||m))?(0,a.jsxs)("div",{className:(0,p.A)(e,"flex flex-col gap-1 text-center"),children:[(0,a.jsx)("div",{className:"rounded-md bg-secondary-veryLight p-2",children:(0,a.jsxs)(g.o5,{className:"flex items-center justify-center gap-2",variant:"caption1-regular",component:"p",children:[(0,a.jsx)(G.A,{className:"inline","aria-hidden":"true"}),x&&m?t("javascript.plan.select_plan.box_settings_modal.percentage_split_voucher_free_shipping",{value:new Intl.NumberFormat(c.locale,{style:"percent",maximumFractionDigits:0}).format(x.percentageDiscount/100)}):t("javascript.accounts.orders.edit_modal_promotion.flash.success")]})}),!!x&&(0,a.jsx)(g.o5,{variant:"caption2-regular",component:"p",children:t("javascript.plan.select_plan.box_settings_modal.eligible_items_disclaimer")})]}):null},ed=()=>{let{t:e}=(0,P.B)();return(0,a.jsxs)("div",{className:"flex items-baseline gap-1 shrink-0 whitespace-nowrap",children:[(0,a.jsx)(g.o5,{component:"h2",variant:"label-medium-strong",children:e("javascript.plan.select_plan.box_settings_modal.dietary_needs")}),(0,a.jsxs)(g.o5,{component:"span",variant:"label-xsmall-regular",className:"text-neutral-700",children:["(",e("javascript.plan.select_plan.box_settings_modal.dietary_needs_optional"),")"]})]})},eu=({hasItems:e})=>{let{t}=(0,P.B)();return e?(0,a.jsxs)("div",{className:"flex items-center gap-1 pt-2",role:"alert",children:[(0,a.jsx)(z.s,{fillColorClass:"fill-current",classNames:"w-4 h-4 text-neutral-800",filled:!1,"aria-hidden":"true"}),(0,a.jsx)(g.o5,{component:"p",variant:"caption2-regular",className:"text-neutral-800",children:t("javascript.plan.select_plan.box_settings_modal.has_items_warning")})]}):null},ep=({onClick:e})=>{let{t}=(0,P.B)();return(0,a.jsxs)("div",{className:"flex flex-col gap-4 pt-4",children:[(0,a.jsxs)("div",{className:"p-4 rounded-container border border-neutral-100 bg-neutral-greyLighter",children:[(0,a.jsx)(et,{}),(0,a.jsxs)(g.o5,{component:"p",variant:"caption1-regular",className:"pt-1",children:[t("javascript.plan.step_3.no_available_rth_slots.title"),"."]}),(0,a.jsx)(g.o5,{component:"p",variant:"caption1-regular",className:"pt-1",children:t("javascript.plan.step_3.no_available_rth_slots.description")})]}),(0,a.jsx)("div",{className:"flex flex-col gap-2 items-center",children:(0,a.jsx)(g.$n,{variant:"primary",onClick:()=>e(),className:"w-full md:max-w-[524px] lg:max-w-[343px]",children:t("javascript.plan.select_plan.box_settings_modal.change_no_people")})})]})},em=()=>"true"===sessionStorage.getItem("funnel_shopping_cart_has_tracked_number_of_people_changed"),ex=({onShowResults:e,recipePreferences:t,preselectedNumberOfPeople:l})=>{let[r,s]=(0,n.useState)("whom"),i=(0,n.useRef)(null),{boxConfiguration:d}=(0,o.Nk)(),{hasItems:u}=D(),{country:h,brand:f,countryLowercase:v,brandShortLowercase:b}=(0,o.PB)(),{state:N}=(0,n.useContext)(w.BR),C=(0,er.bP)(N.signupMode),{t:A,stringifyTranslation:k}=(0,P.B)(),{uuid:O,locale:S}=N,[L,I]=(0,n.useState)(l??N.boxSettings?.numberOfPeople??2),[T,R]=(0,n.useState)(N?.location?.zipcode??""),[z,$]=(0,n.useState)(N.delivery?.deliveryDetails?.city??""),[H,W]=(0,n.useState)(N.boxSettings?.deliveryWeek??null),K=(0,M.aM)(T,h),[q,Q]=(0,n.useState)(!1),[Y,Z]=(0,n.useState)(N.recipePreferences?.[0]&&N.recipePreferencesNames?.[0]?{id:N.recipePreferences?.[0],name:N.recipePreferencesNames?.[0]}:null),G=e=>{sessionStorage.setItem("funnel_shopping_cart_has_tracked_number_of_people_changed","true"),(0,E.u4)({name:E.tL.boxSettingsNumberOfPeopleChanged,visitId:O,country:v,brand:b,snapshot:{numberOfPeople:e}})},J=()=>{s("week")},{data:ee,isLoading:et}=(0,c.useQuery)((0,_.jd)(O,T||"",z,_.wL[L]),()=>(0,_.sC)(O,T||"",S,z,_.wL[L]),{keepPreviousData:!1,enabled:K,onSuccess:e=>{(0,E.u4)({name:E.tL.boxSettingsLocationRetrieved,visitId:O,country:v,brand:b,snapshot:{amountOfWeeks:e.length}}),N.boxSettings?.deliveryWeek&&!e.find(e=>e.from===N.boxSettings?.deliveryWeek)&&W(null)}}),{data:ea}=(0,c.useQuery)((0,_.mi)(N.uuid,T,z,_.wL[L]),()=>(0,_.ZJ)(N.uuid,T,N.locale,z,_.wL[L]),{enabled:"AU"===h&&K&&1===L}),en=ea?.firstDelivery.initialItems.length===0,{data:es,isLoading:eo}=(0,c.useQuery)(`zipcodeLookup-${T}`,()=>(0,M.kW)(T,N.locale),{enabled:"AU"===h&&K}),ex=es?.suburbs??[],eg=es?.active,eh=!!eg&&!!ex?.length,ef=eh&&!z,ev=1===L&&"AU"===h&&en&&(eh&&!!z||!!eg&&0===ex.length);(0,n.useEffect)(()=>{"where"!==r||!K||et||"AU"===h&&(eo||eh||ev)||J()},[et,ev,eo,T]),(0,n.useEffect)(()=>{ev&&W(null)},[ev]);let eb="AU"===h&&ef||ev,ej=t[y.Ko[L]],e_=K&&L>0&&ee&&ee.length>0&&H&&ee.find(e=>e.from===H);(0,n.useEffect)(()=>{"where"===r&&i.current&&i.current.focus()},[r]);let ey=e=>{em()||G(e),L!==e&&I(e)},ew=e=>{switch(e){case"whom":if(1===L)return k(A("javascript.plan.select_plan.box_settings_modal.number_people",{count:L}));return k(A("javascript.plan.select_plan.box_settings_modal.number_people_plural",{c
1ount:L}));case"where":return T||null;case"week":if(!H)return null;{let e=(0,B.J)({country:h}),t=(0,m.H)(H);return k(A("javascript.plan.select_plan.box_settings_modal.from_date",{date:(0,x.GP)(t,"MMM d",{locale:e})}))}case"recipe-preferences":if(!Y)return null;return ej?.find(e=>e.id===Y?.id)?.title??null}},eN=e=>{r===e?s(null):("where"!==e||em()||G(L),s(e))},eC=(d?.length??0)>4;return(0,a.jsxs)("div",{className:"flex flex-col min-h-full",children:[(0,a.jsx)("div",{className:"flex flex-col flex-1",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(g.Sn,{title:A("javascript.plan.select_plan.box_settings_modal.title"),subtitle:A("javascript.plan.select_plan.box_settings_modal.subtitle")}),(0,a.jsx)(ec,{className:"mb-6"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 lg:gap-4",children:[(0,a.jsxs)(g.Jt,{expanded:"whom"===r,icon:(0,a.jsx)(V,{section:"whom"}),title:A("javascript.plan.select_plan.box_settings_modal.for_whom"),value:ew("whom"),addLabel:A("spree.add"),collapseAriaLabel:A("spree.close"),onToggle:()=>eN("whom"),children:[(0,a.jsx)("div",{className:(0,p.A)({"grid grid-cols-2 gap-2":!eC,"flex flex-col lg:grid lg:grid-cols-2 gap-2":eC}),children:d?d.map(({numberOfPeople:e})=>(0,a.jsx)(ei,{mobileLayout:eC?"list":"grid",isSelected:L===e,personsNumber:e,onClick:()=>ey(e)},e)):[0,1,2,3].map(e=>(0,a.jsx)(g.Xb,{className:"h-[28px] w-[120px]"},e))}),(0,a.jsx)(eu,{hasItems:u})]}),(0,a.jsxs)(g.Jt,{expanded:"where"===r,icon:(0,a.jsx)(V,{section:"where"}),title:A("javascript.plan.select_plan.box_settings_modal.where_to"),value:ew("where"),addLabel:A("spree.add"),collapseAriaLabel:A("spree.close"),onToggle:()=>eN("where"),children:[(0,a.jsx)(X,{ref:i,postalCode:T,onPostalCodeChange:e=>{e!==T&&"true"!==sessionStorage.getItem("funnel_shopping_cart_has_tracked_location_entered")&&(sessionStorage.setItem("funnel_shopping_cart_has_tracked_location_entered","true"),(0,E.u4)({name:E.tL.boxSettingsLocationFirstChange,visitId:O,country:v,brand:b})),e!==T&&Q(!1),W(null),R(e)},selectedSuburb:z,onSuburbChange:e=>{$(e)},showError:q,onSubmit:()=>{K?J():Q(!0)}}),ev&&(0,a.jsx)(ep,{onClick:()=>{s("whom"),ey(2)}}),!ev&&(0,a.jsx)(eu,{hasItems:u})]}),(0,a.jsx)(g.Jt,{expanded:"week"===r,disabled:!K||eb,icon:(0,a.jsx)(V,{section:"week"}),title:A("javascript.plan.select_plan.week_selector.title"),value:ew("week"),addLabel:A("spree.add"),collapseAriaLabel:A("spree.close"),onToggle:()=>eN("week"),children:(0,a.jsx)(U,{weeks:ee,selectedWeek:H,onSelectWeek:e=>{H!==e&&W(e)},hideHeader:!0,children:(0,a.jsx)(eu,{hasItems:u})})}),!C&&(0,a.jsx)(g.Jt,{expanded:"recipe-preferences"===r,disabled:!K||eb,icon:(0,a.jsx)(V,{section:"recipe-preferences"}),title:(0,a.jsx)(ed,{}),value:ew("recipe-preferences"),addLabel:A("spree.add"),collapseAriaLabel:A("spree.close"),onToggle:()=>eN("recipe-preferences"),children:(0,a.jsx)(F,{selectedRecipePreference:Y,recipePreferences:ej,onSelect:Z})})]})]})}),(0,a.jsx)("div",{className:"sticky bottom-0 py-4 bg-neutral-00 lg:pb-14 lg:pt-16",children:(0,a.jsx)(g.$n,{onClick:()=>{(0,E.u4)({name:E.tL.boxSettingsCTAClicked,visitId:O,country:v,brand:b,snapshot:{postalCode:T,hasValidPostalcode:K,hasDeliveryWeek:!!H,autoPickedDeliveryWeek:!H&&!!ee?.[0],recipePreference:C?Y:Y??j(ej,f),flow:(0,E.Qe)(N.signupMode)}}),el.A.gql.user.upsertVisit(N,{numberOfPersons:L}),e_?e({numberOfPeople:L,postalCode:T,deliveryWeek:H,...C?{}:{recipePreference:Y??j(ej,f)}}):K?H&&ee?.find(e=>e.from===H)||J():(Q(!0),i.current&&i.current.focus(),em()||G(L),s("where"))},className:"w-full md:mx-auto md:max-w-[524px] lg:max-w-[343px]",variant:"primary",children:A("javascript.plan.select_plan.box_settings_modal.cta")})})]})},eg=({recipePreferences:e,onShowResults:t})=>{let l=eo.x.numberOfPeople,{state:r}=(0,n.useContext)(w.BR),{uuid:s}=r,{brand:i,countryLowercase:c,brandShortLowercase:d}=(0,o.PB)(),{t:u}=(0,P.B)(),{hasItems:p}=D();eo.x.zipCode[r.locale.country];let m=e[y.Ko[l]],[x,h]=(0,n.useState)(r.recipePreferences?.[0]&&r.recipePreferencesNames?.[0]?{id:r.recipePreferences[0],name:r.recipePreferencesNames[0]}:null),f=!!m?.length;return(0,a.jsxs)("div",{className:"flex flex-col min-h-full",children:[(0,a.jsx)("div",{className:"flex flex-col flex-1",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 py-6",children:[(0,a.jsx)(g.o5,{component:"h1",variant:"heading-large-regular",children:u("javascript.plan.select_plan.box_settings_modal.title")}),(0,a.jsx)(g.o5,{component:"h2",variant:"label-small-regular",className:"text-neutral-800",children:u("javascript.plan.select_plan.recipe_preferences.title")})]}),(0,a.jsx)("div",{className:"flex flex-col gap-2 lg:gap-4",children:(0,a.jsxs)(g.Jt,{expanded:!0,icon:(0,a.jsx)(V,{section:"recipe-preferences"}),title:u("javascript.plan.select_plan.box_settings_modal.dietary_needs"),children:[(0,a.jsx)(F,{selectedRecipePreference:x,recipePreferences:m??[],onSelect:h}),(0,a.jsx)(eu,{hasItems:p})]})})]})}),(0,a.jsx)("div",{className:"sticky bottom-0 py-4 bg-neutral-00 lg:pb-14 lg:pt-16",children:(0,a.jsx)(g.$n,{onClick:()=>
1{if(!f)return;let e=x??j(m,i);(0,E.u4)({name:E.tL.boxSettingsCTAClicked,visitId:s,country:c,brand:d,snapshot:{postalCode:"DEFAULT",hasValidPostalcode:!0,hasDeliveryWeek:!0,autoPickedDeliveryWeek:!0,recipePreference:e,flow:(0,E.Qe)(r.signupMode)}}),el.A.gql.user.upsertVisit(r,{numberOfPersons:l}),t({recipePreference:e})},disabled:!f,className:"w-full md:mx-auto md:max-w-[524px] lg:max-w-[343px]",variant:"primary",children:u("javascript.plan.select_plan.box_settings_modal.cta")})})]})},eh=({recipePreferences:e,preselectedNumberOfPeople:t})=>{let{dispatch:l,state:r}=(0,n.useContext)(w.BR),{brandShortLowercase:s,countryLowercase:i}=(0,o.PB)(),{boxSettingsModalMode:c,isBoxSettingsModalOpen:d,closeBoxSettingsModal:u}=D();(0,n.useEffect)(()=>{d&&(0,E.u4)({name:E.tL.boxSettingsModalView,visitId:r.uuid,country:i,brand:s})},[d]);let p=e=>{"numberOfPeople"in e&&"postalCode"in e&&"deliveryWeek"in e&&(l(w.Te.UpdateBoxSettings({numberOfPeople:e.numberOfPeople,deliveryWeek:e.deliveryWeek})),l(w.Te.UpdateAddressParams({location:{zipcode:e.postalCode}}))),e.recipePreference&&l(w.Te.UpdateRecipePreferences([e.recipePreference])),u()};return(0,a.jsx)(b,{isOpen:d,modalId:"box-settings-modal",children:"recipe-preferences-only"===c?(0,a.jsx)(eg,{recipePreferences:e,onShowResults:p}):(0,a.jsx)(ex,{preselectedNumberOfPeople:t,onShowResults:p,recipePreferences:e})})};var ef=l(7582),ev=l(3492);let eb=e=>e.extraFees.reduce((e,t)=>e+t.totalAmount,0),ej=({extraFees:e})=>{let{t}=(0,P.B)(),{locale:l}=(0,ea.P)(),r=(0,ee.OY)(l);return void 0===e||0===e?null:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsxs)(g.o5,{variant:"label-small-strong",className:"whitespace-nowrap dn:text-secondary-dark",children:[e>0?"+":"-"," ",(0,ee.Cv)(Math.abs(e),r.value,l)]}),"\xa0",(0,a.jsxs)(g.o5,{variant:"label-small-regular",className:"whitespace-nowrap text-neutral-700",children:["/ ",t("accounts.orders.price_breakdown.portion")]})]})},e_=({image:e,name:t,extraFees:l,isSelected:r,onSelect:n,mobileLayout:s})=>{let{t:i}=(0,P.B)();return(0,a.jsxs)("button",{className:(0,p.A)("flex h-[82px] shrink-0 items-center justify-center gap-3 rounded-container border border-solid px-4 py-3 lg:w-full","horizontal"===s?"w-[211px] md:w-[230px]":"w-full",{"border-neutral-700 bg-neutral-75":r,"border-neutral-100 bg-neutral-white hover:border-neutral-200 hover:bg-neutral-50":!r}),"aria-label":`${i("spree.select")} ${t}`,onClick:n,children:[(0,a.jsx)("div",{className:"flex aspect-square size-[56px] shrink-0 items-center justify-center",children:e}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,a.jsx)(g.o5,{variant:"label-small-strong",className:(0,p.A)("whitespace-break-spaces text-left",{"mt-1":!!l}),children:t}),(0,a.jsx)(ej,{extraFees:l})]})]})},ey=({mobileLayout:e,recipeVariants:t,selectedIndex:l,onSelectionChanged:r,isLoading:n})=>{let{brand:s}=(0,o.PB)(),{t:i}=(0,P.B)(),c=t.length%2!=0,d=n?[0,1].map(e=>({key:e,content:(0,a.jsx)(g.Xb,{className:"h-[82px] w-[211px] lg:w-full shrink-0 items-center justify-center gap-3 rounded-container border border-solid px-4 py-3 md:w-[230px] "},e)})):t.map((t,n)=>{var o,c,d;let u={image:(o=t.variantSpecificIngredientImage||void 0,c=t.variantName??i("spree.variant"),d=s,o?(0,a.jsx)("img",{className:"rounded-full object-cover",src:o,alt:c}):"marley"===d?(0,a.jsx)(ef.A,{}):"dinnerly"===d?(0,a.jsx)(ev.A,{}):(0,a.jsx)(a.Fragment,{})),name:t.variantName??i("spree.variant"),mobileLayout:e};return u.extraFees=eb(t),{key:n,content:(0,a.jsx)(e_,{...u,isSelected:n===l,onSelect:()=>{r(n)}},n)}});return(0,a.jsx)(g.FN,{items:d,className:(0,p.A)("flex scroll-px-4 gap-2 pb-1 lg:scroll-px-8 lg:p-0 lg:grid lg:grid-cols-2",{"px-4":"horizontal"===e,"flex-col":"vertical"===e,"lg:[&>*:first-child]:col-span-2":c}),initialPageWithItem:l,initialPageAnimation:!0,"aria-label":i("spree.variants"),renderItem:({index:e,item:t,isSnapPoint:l})=>(0,a.jsx)(g.A7,{isSnapPoint:l,children:(0,a.jsx)("div",{children:t.content})},e)})};var ew=l(3830);let eN=`${R.T.BASE_PREFIX_FUNNEL}/images/not_found.jpg`,eC=e=>({id:e.id,culinaryId:e.culinaryId,title:e.title,imageUrl:e.image?.url||eN,extraFeesTotal:eb(e),recipeType:e.recipeType,pricePerPortion:e.pricePerPortion}),eP=e=>({...eC(e),isVariant:!0,variantName:e.variantName??void 0});var eE=l(3839);let eA=eo.x.numberOfPeople,ek=async({country:e,brand:t,culinaryId:l,numberOfPeopleAvailable:a})=>{let r=await el.A.gql.menu.getCulinaryRelatedRecipes({country:e,brand:t,culinaryId:l});return a.map(e=>({numberOfPeople:e,recipe:r.data.data.recipesByCulinaryId.find(t=>y.Oo[e]===t.segment)??null}))},eO=()=>{let{t:e}
1=(0,P.B)(),{isBoxNumberOfPeopleModalOpen:t,pendingAddToCart:l,closeBoxNumberOfPeopleModal:r,confirmBoxNumberOfPeople:s}=D(),{state:d}=(0,n.useContext)(i.B),{country:u,brandShort:p}=(0,o.PB)(),{boxConfiguration:m}=(0,o.Nk)(),[x,h]=(0,n.useState)(null),[f,v]=(0,n.useState)(0),[b,j]=(0,n.useState)(!1),_=l?.items??[],y=_.length>1,w=y||0===_.length?null:_[0].culinaryId,{data:N,isLoading:C}=(0,c.useQuery)(["getRelatedRecipesByNumberOfPeople",w,`numberOfPeople-${m?.map(e=>e.numberOfPeople).join(",")??"?"}`],()=>ek({country:u,brand:p,culinaryId:w??0,numberOfPeopleAvailable:m?.map(e=>e.numberOfPeople)??[]}),{enabled:!!m&&!d.boxSettings&&!!w&&!y});(0,n.useEffect)(()=>{if(!l||y)return;let e=_[0];if(e&&l.recipeVariants){let t=l.recipeVariants.findIndex(t=>t.id===e.id);v(-1!==t?t:0)}},[l,w,y]);let[E,A]=(0,n.useState)(null),k=()=>{A(null),h(null),v(0),j(!1),r()},O=(0,eE.g)();if((0,n.useEffect)(()=>{O&&E&&(s(E.selectedNumberOfPeople,O,E.cartItemsToAdd),k())},[O,E]),d.boxSettings)return null;let S=x&&N?N.find(e=>e.numberOfPeople===x)?.recipe?.recipeVariants:l?.recipeVariants,L=!!(S&&S.length>0),I=L?S[f]?.title??_[0]?.title??"":_[0]?.title??"",T=(m??[]).map(e=>e.numberOfPeople),M=(e,t=null)=>{O?(s(e,O,t),k()):A({selectedNumberOfPeople:e,cartItemsToAdd:t})},B=x===eA?l?.recipeVariants:N?.find(e=>e.numberOfPeople===x)?.recipe?.recipeVariants,R=B&&(0===B.length||B.length>0&&f<B.length),z=y?null!==x&&(!B||R):(!B||R)&&(x===eA||x&&N),F=!y&&null!==x&&x!==eA&&C;return(0,a.jsx)(ew.l,{isOpen:t,closeDialog:k,modalId:"box-number-of-people-modal",hideCloseButton:b,noPadding:!0,children:(0,a.jsxs)("div",{className:"flex flex-col max-h-[80dvh] lg:max-h-[90dvh]",children:[b?(0,a.jsxs)("div",{className:"flex flex-col gap-2 px-4 lg:gap-4 mb-4 lg:mb-8 pt-4 lg:pt-8",children:[(0,a.jsx)(g.o5,{component:"p",variant:"title2",className:"text-center",children:e("javascript.plan.select_plan.box_number_of_people_modal.update_menu_prompt_title")}),(0,a.jsx)(g.o5,{component:"p",variant:"body-regular",className:"text-center text-neutral-700 lg:px-12",children:e((x??eA)===1?"javascript.plan.select_plan.box_number_of_people_modal.update_menu_prompt_description":"javascript.plan.select_plan.box_number_of_people_modal.update_menu_prompt_description_plural",{numberOfPeopleText:e(`number.human.as_text.${x??eA}`)})})]}):(0,a.jsx)("div",{className:"overflow-y-auto overflow-x-hidden lg:px-8",children:(0,a.jsxs)("div",{className:"flex flex-col gap-6 pb-2",children:[(0,a.jsx)(g.o5,{component:"p",variant:"title2",className:"text-center lg:text-left px-4 lg:px-0",children:e("javascript.plan.select_plan.box_number_of_people_modal.title",y?{recipeName:e("activerecord.models.recipe_plural")}:{recipeName:(0,a.jsx)("div",{children:I})})}),(0,a.jsxs)("div",{className:"flex flex-col gap-6 lg:p-8 lg:border lg:border-neutral-100 lg:rounded-2xl",children:[L&&S&&(0,a.jsxs)("div",{className:"overflow-hidden",children:[(0,a.jsx)(g.o5,{variant:"body-strong",className:"mb-4 px-4 lg:px-0",children:e("javascript.dish_detail.customize_your_choice")}),(0,a.jsx)(ey,{mobileLayout:"horizontal",isLoading:null!=x&&x!==eA&&C,recipeVariants:S,selectedIndex:f,onSelectionChanged:v})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4 px-4 lg:px-0",children:[(0,a.jsxs)(g.o5,{component:"p",variant:"body-strong",children:[e("javascript.plan.select_plan.box_settings_modal.for_whom"),"*"]}),(0,a.jsx)("div",{className:"flex flex-col gap-2 lg:grid lg:grid-cols-2",children:T.map(e=>(0,a.jsx)(ei,{mobileLayout:"list",personsNumber:e,isSelected:x===e,onClick:()=>h(e)},e))})]}),(0,a.jsx)(g.o5,{component:"p",variant:"caption2-regular",className:"text-neutral-950 px-4 lg:px-0 text-center",children:e("javascript.plan.select_plan.box_number_of_people_modal.disclaimer")})]})]})}),!b&&(0,a.jsx)("div",{className:"w-full lg:hidden bg-neutral-white h-2 shadow-[0_-2px_8px_0_rgba(18,17,12,0.10)]","aria-hidden":!0}),(0,a.jsx)("div",{className:"shrink-0 bg-neutral-white p-4 lg:p-8 lg:pt-4 lg:rounded-2xl",children:b?(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,a.jsx)(g.$n,{variant:"destructive",onClick:()=>j(!1),className:"w-full lg:w-48 ml-auto",children:e("spree.cancel")}),(0,a.jsx)(g.$n,{variant:"primary",onClick:()=>{M(x??eA,null)},className:"w-full lg:w-48 mr-auto",children:e("javascript.plan.select_plan.box_number_of_people_modal.update_menu_prompt_cta")})]}):(0,a.jsx)(g.$n,{variant:"primary",onClick:()=>{let e;
1if(null!==x){if(y)return void(x===eA?M(x,l.items):j(!0));if(x===eA||N){if(x===eA)e=L&&S?.[f]?eP(S[f]):_[0];else{let t=N?.find(e=>e.numberOfPeople===x)?.recipe;if(!t)return void j(!0);let l=t.recipeVariants?.[f];e=l?eP(l):eC(t)}M(x,[e])}}},disabled:!z,className:"w-full lg:w-48 mx-auto",children:F?(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(W.a,{isWhite:!0})}):e("javascript.accounts.orders.edit_modal.add")})})]})})},eS=async({country:e,brandShort:t,deliveryDate:l,zipcode:a,numberOfPeople:r})=>(await el.A.gql.menu.getMenuAddons({country:e,brandShort:t,deliveryDate:l,zipcode:a,numberOfPeople:r})).data.data.addOnMenu,eL=async({id:e,brandShort:t,country:l})=>{let a=(await el.A.gql.menu.getAddOnDetails({id:e,brandShort:t,country:l})).data.data.addOnDetails;if(!a)throw Error("Add-on details returned null");return a},eI=()=>{let{state:e}=(0,n.useContext)(i.B);return(0,er.bP)(e.signupMode)},eT=(e,{country:t,locale:l,listPriceLabel:a,lowestIn30DaysLabel:r})=>(0,g.JY)({...e,pricingRegion:(0,g.zy)(t)},{formatPrice:e=>(0,ee.vv)(e,l),listPriceLabel:a,lowestIn30DaysLabel:r}),eD=()=>{let{country:e,locale:t}=(0,ea.P)(),{t:l}=(0,P.B)();return{country:e,locale:t,listPriceLabel:l("accounts.orders.edit_modal.list_price"),lowestIn30DaysLabel:l("accounts.orders.edit_modal.last_30_days")}},eM=({id:e,pricePerPortion:t,recipeDiscounts:{mealsDiscountFraction:l,discountedRecipePricesById:a}})=>{if(null==t)return{displayPrice:null,originalPrice:null};let r=a[e],n=r?(0,g.SG)(r.discountedPrice,r.quantity):null;return{displayPrice:(null!=n&&n<t?n:null)??(0,g.HA)(t,l)??t,originalPrice:t}};var eB=l(8129);let eR=()=>{let{state:e}=(0,n.useContext)(i.B),{shoppingCart:t}=D(),{virtualPrice:l,isPreviousData:a}=(0,eB.S)(t),r=(0,en.z)(e),s=r?.valid?(0,J.dl)({numberOfMeals:null,numberOfPortions:e.boxSettings?.numberOfPeople||eo.x.numberOfPeople,planPrice:null,promo:r}):null,o=s?.type==="percentage"&&s.currentDiscount>0?s.currentDiscount/100:null,c=Object.keys(t.recipes).length>0,d=c&&!!l&&!a;return(({discountDetails:e,voucherDiscountFraction:t,isPriceFinal:l,hasFixedAmountVoucher:a=!1})=>{let r=(0,g.Um)(e?.appliedDiscounts??[],"MEALS"),n=a?null:(0,g.Um)(e?.appliedDiscountsWithPromotion??[],"MEALS");return{mealsDiscountFraction:n??r??(l?null:t),discountedRecipePricesById:l&&(null==n||n===r)?(0,g.QP)(e?.discountedOrderItems,"Recipe"):{}}})({discountDetails:c?l?.discountDetails:void 0,voucherDiscountFraction:o,isPriceFinal:d,hasFixedAmountVoucher:s?.type==="fixed"})},ez=({recipe:e})=>{let{t}=(0,P.B)(),l=eI(),{displayPrice:r,originalPrice:n}=(({id:e,pricePerPortion:t})=>eM({id:e,pricePerPortion:t,recipeDiscounts:eR()}))({id:e.id,pricePerPortion:l?e.pricePerPortion:null}),s=eT({surface:"onDemand",itemKind:"recipe",isSaverRecipe:"CORE_DOWN"===e.recipeType,displayPrice:r,originalPrice:n,portionLabel:t("accounts.orders.price_breakdown.portion")},eD());return l&&s?(0,a.jsx)(g.rs,{...s}):(0,a.jsx)(ej,{extraFees:eb(e)})},eF=({addon:e})=>{let{t}=(0,P.B)(),{locale:l}=(0,o.PB)(),r=e.pricing?.total??0,n=e.isDiscounted?e.discountedPrice??r:r,s=(0,ee.OY)(l),i=e.isDiscounted&&n!==r,c=e.last30DaysLowestPrice?new Intl.NumberFormat(l,{style:"currency",currency:s.value,currencySign:"accounting"}).format(e.last30DaysLowestPrice):0;return(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(g.AA,{className:"dn:!text-neutral-black",attributes:e.categories.map(e=>e.name)}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.o5,{variant:"caption1-strong",children:(0,ee.Cv)(n,s.value,s.locale)}),(0,a.jsx)(g.o5,{variant:"caption1-regular",component:"span",className:"line-through",children:(0,ee.Cv)(r,s.value,s.locale)})]}),!i&&(0,a.jsx)(g.o5,{variant:"caption1-strong",children:(0,ee.Cv)(n,s.value,s.locale)})]}),e.last30DaysLowestPrice&&(0,a.jsxs)(g.o5,{variant:"caption2-regular",className:"text-neutral-black",children:[t("accounts.orders.edit_modal.last_30_days"),": ",c]})]})]})},eV=({onClick:e,hasVariants:t=!1})=>{let{t:l}=(0,P.B)(),r=l(t?"spree.add_variant":"spree.add_to_cart");return(0,a.jsx)(g._C,{onClick:e,ariaLabel:r,className:"size-10 rounded-default bg-primary-light shadow-md hover:shadow-lg"})},e$=(e,t)=>e[t]?.amount??0,eH=(e,t)=>t.some(t=>e$(e,t)>0),eU=({itemType:e,item:t,variantIds:l,onCustomize:r})=>{let{t:s}=(0,P.B)(),{state:o}=(0,n.useContext)(i.B),{countryLowercase:c,brandShortLowercase:d}=(0,ea.P)(),{shoppingCart:u,addItem:p,removeItem:m,clearItem:x,boxSett
1ings:h}=D(),f=!!l?.length,v=u["RECIPE"===e?"recipes":"addOns"],b=O(e$(v,t.id),"RECIPE"===e?h?.numberOfPeople:1),j=f?eH(v,l):b>0,_=()=>{((0,E.u4)({name:E.tL.cartAddButtonClicked,visitId:o.uuid,country:c,brand:d,snapshot:{itemType:e,itemId:t.id,source:"PRODUCT_LIST",flow:(0,E.Qe)(o.signupMode)}}),r)?r():p(e,t)};return j?(0,a.jsxs)(g.VI,{className:"rounded-default bg-primary-light shadow-md",ariaLabel:s("spree.amount"),children:[(0,a.jsx)(g.Yi,{mode:f?"removeAll":"step",onClick:()=>{f&&l?l.forEach(t=>x(e,t)):m(e,t.id)},ariaLabel:s("layouts.frontend.basket_tooltip.cart_tooltip.remove"),className:"w-8 h-9"}),f?(0,a.jsx)(g.YM,{}):(0,a.jsx)(g.D8,{children:b}),(0,a.jsx)(g.ES,{onClick:_,ariaLabel:s("spree.add"),className:"w-8 h-9"})]}):(0,a.jsx)(eV,{onClick:_,hasVariants:f})},eW=({product:e})=>{let{t}=(0,P.B)(),l=eI();if("ADDON"===e.itemType)return(0,a.jsx)(eF,{addon:e.addon});if("RECIPE"===e.itemType){let{recipe:r,variantIds:n}=e,s=!!n?.length,i=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.tZ,{attributes:r.attributes,dietType:r.category.displayText,dietaryAllergenIcons:r.dietaryAllergenIcons,heatLevelIcon:r.heatLevelIcon,recipeServingTime:r.recipeServingTime,recipeType:r.recipeType,extraFees:void 0,variantsLabel:t("accounts.orders.edit_modal.has_variants"),hasVariants:s}),(0,a.jsx)(ez,{recipe:r})]});return l?(0,a.jsx)("div",{className:"flex flex-col gap-2",children:i}):i}},eK=e=>{let{t,stringifyTranslation:l}=(0,P.B)(),{item:r,hideCartControls:n,overwriteBadgeValue:s,people:i,itemType:
1o,onProductTileClick:c}=e,{shoppingCart:d}=D(),u=d["RECIPE"===o?"recipes":"addOns"],m="RECIPE"===o?e.variantIds:void 0,x=m?.length?eH(u,m):e$(u,r.id)>0,h=!0===n?void 0:(0,a.jsx)(eU,{onCustomize:"RECIPE"===o&&e.variantIds?.length?e.onCustomizeClick:void 0,itemType:e.itemType,item:r,variantIds:"RECIPE"===e.itemType?e.variantIds:void 0}),f="RECIPE"===o?e.recipe.subtitle:void 0;return(0,a.jsx)(g.DL,{image:r.imageUrl||eN,title:r.title,people:i,peopleLabel:i?l(t(1===i?"javascript.accounts.orders.edit_modal.servings.singular":"javascript.accounts.orders.edit_modal.servings.plural",{count:i})):void 0,subtitle:f,variant:"editable",className:(0,p.A)("h-full",s&&"[&>*:nth-child(2)>*:first-child]:bg-information-100"),onClick:c,badgeValue:s??("RECIPE"===o&&e.recipe.badge?.value||null),discountedBadgeLabel:t("accounts.orders.edit_modal.sale"),actionIcon:h,addedBadgeLabel:t("accounts.orders.edit_modal.added"),status:x?"added":"default",children:(0,a.jsx)(eW,{product:e})})},eq=e=>{let t=Array.isArray(e)?e[0]:e;if(!t)return null;let l=t.split(",").reduce((e,t)=>{let[l,a]=t.split(":"),r=a?.split("|").filter(Boolean)??[];return l&&r.length>0&&(e[l]=r),e},{});return Object.keys(l).length>0?l:null},eQ=({urlFilters:e,preferenceFilters:t,skipPreferenceFilters:l})=>e||(l?{}:t),eY=({productCategory:e,filters:t})=>{if("true"!==(0,M.fE)().get(M.lH.devShowFilters))return null;let l=Object.entries(t).filter(([,e])=>e.length>0).map(([e,t])=>`${e}:${t.join("|")}`).join(","),r=`${window.location.origin}${window.location.pathname}?${M.lH.productCategory}=${e}`+(l?`&${M.lH.filters}=${encodeURIComponent(l)}`:"");return(0,a.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-50 flex items-center gap-2 bg-black/90 p-3 text-xs text-white",children:[(0,a.jsx)("span",{className:"flex-1 overflow-x-auto whitespace-nowrap",children:r}),(0,a.jsx)("button",{type:"button",className:"shrink-0 rounded bg-white px-3 py-1 font-medium text-black",onClick:()=>{navigator.clipboard&&navigator.clipboard&&navigator.clipboard.writeText(r)},children:"Copy"})]})},eZ=({noOfResults:e,onFiltersChange:t,productCategory:l})=>{let{filters:r}=(0,g.FX)();return(0,n.useEffect)(()=>{t(r)},[r]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Cu,{tabsEnabled:!0,title:"",noOfResults:e}),(0,a.jsx)(eY,{productCategory:l,filters:r})]})},eX=({noOfResults:e,filterCategories:t,onFiltersChange:l,preselectedFilters:r={},noPaddingTopDesktop:s=!1,productCategory:i})=>{let{brandShort:c}=(0,o.PB)(),{t:d}=(0,P.B)(),u=(0,n.useMemo)(()=>({show_results:d("accounts.orders.edit_modal.findability.show_results"),clear_all:d("accounts.orders.edit_modal.findability.clear_all"),apply_filters:d("accounts.orders.edit_modal.findability.apply_filters"),result:d("accounts.orders.edit_modal.findability.result"),result_plural:d("accounts.orders.edit_modal.findability.result_plural"),hide_filters:d("accounts.orders.edit_modal.findability.hide_filters"),show_filters:d("accounts.orders.edit_modal.findability.show_filters"),filters:d("accounts.orders.edit_modal.findability.filters"),categories:d("accounts.edit_modal.findability.categories"),applied:d("accounts.orders.edit_modal.findability.applied"),close:d("spree.close"),back:d("spree.back")}),[d]),m=(0,n.useMemo)(()=>{let e={};return Object.entries(r).forEach(([l,a])=>{let r=t.find(e=>e.key===l);if(r&&r.values){let t=new Set(r.values.map(e=>e.valueKey)),n=a.filter(e=>t.has(e));n.length>0&&(e[l]=n)}}),e},[r,t]);return(0,a.jsx)(g.B4,{labels:u,initialState:{...g.th,categories:t,filters:m},brand:c,children:(0,a.jsx)("div",{className:(0,p.A)("xl:px-20 mb-2 w-full p-4 pt-0 lg:px-8 overflow-x-hidden",!s&&"lg:pt-4"),children:(0,a.jsx)(eZ,{noOfResults:e,onFiltersChange:l,productCategory:i})})})};var eG=l(5317);let eJ=()=>{let{state:e,dispatch:t}=(0,n.useContext)(w.BR),{brandShort:l}=(0,o.PB)(),r=e.notifications?.filter(e=>e.id.includes("promo_code_error"));return r?.length?(0,a.jsx)(a.Fragment,{children:r.map(e=>(0,a.jsx)(eG.C,{text:e.text,type:e.type,brand:l,displayTime:void 0,onClose:()=>t(w.Te.RemoveNotification(e.id))},e.id))}):null},e0=[6,7,6,8,6,8,7,6,8,6,6,8,7,6,8],e1=()=>(0,a.jsx)("div",{className:"w-full py-4",children:(0,a.jsx)("div",{className:"no-scrollbar flex gap-2 overflow-hidden",children:Array.from({length:12}).map((e,t)=>(0,a.jsx)("div",{style:{width:(e0[t]||6)+"rem"},className:"h-10 w-24 shrink-0 animate-pulse rounded-full bg-neutral-greyLight"},t))})}),e2=({loading:e,className:t})=>(0,a.jsx)("div",{className:(0,p.A)("relative aspect-square w-full shrink-0",t),children:(0,a.jsx)("div",{className:(0,p.A)("absolute inset-0 size-full select-none rounded-default object-cover object-center",{"bg-neutral-greyLight animate-pulse":e})})}),e3=({children:e})=>(0,a.jsx)("div",{className:"xl:px-20 grid w-full grid-cols-2 gap-x-4 gap-y-6 bg-neutral-white px-4 md:grid-cols-3 lg:grid-cols-4 lg:px-8 pb-4 xl:grid-cols-6",children:e});var e5=l(6875);let e4=({isOnDemand:e})=>{let{t}=(0,e5.B)();return(0,a.jsx)(g.o5,{className:"mb-4 xl:px-20 px-4 lg:px-8",component:"h1",variant:"heading-medium-regular",children:t(e?"javascript.on_demand.page.title":"javascript.build_your_own_box.page.title")})},e6=({children:e})=>(0,a.jsx)("main",{className:"-mt-2 bg-neutral-white w-full max-w-[1800px] mx-auto",children:e});var e7=l(1784),e8=l(4615),e9=l(5847);let te="mx-4 mb-6 rounded-md bg-secondary-400 py-2 lg:mx-8 xl:mx-20 text-center",tt=eo.x.numberOfPeople,tl=()=>{let{locale:e}=(0,o.PB)(),t=(0,ee.OY)(e),l=(0,n.useMemo)(()=>(0,M.fE)(),[]);return{locale:e,currency:t,referrerName:l.get(M.lH.referrerName)?.toString()||null}},ta=({className:e})=>{let{t}=(0,P.B)();return(0,a.jsx)(g.o5,{variant:"caption2-regular",component:"div",className:(0,p.A)("mt-1 text-neutral-charcoal",e),children:t("javascript.plan.select_plan.box_settings_modal.eligible_items_disclaimer")})},tr=({currentDiscount:e,freeShipping:t,isExpanded:l,type:r,setIsExpanded:s})=>{let{state:i}=(0,n.useContext)(w.BR),{brandShortLowercase:c}=(0,o.PB)(),{t:d}=(0,P.B)(),{locale:u,currency:m,referrerName:x}
1=tl(),h=(0,J.lZ)(!!e,t,!0,x),f=i.boxSettings?.numberOfPeople||0,v=(0,en.z)(i),b=(0,n.useMemo)(()=>{if(v?.multi_tier_settings&&!(v.multi_tier_settings.length<=1))return v.multi_tier_settings.map(e=>{let t=(0,J.dl)({numberOfMeals:null,numberOfPortions:f,planPrice:null,promo:v,orderOrdinal:e.order_ordinal}),l=d("javascript.plan.step_1.promotions.split_order_voucher.box_breakdown.value_off",{value:(0,J.T6)({communicationStyle:v.communication_style,promoType:t.type,currentDiscount:t.currentDiscount,orderAmount:null,currencyValue:m.value,locale:u})});return{ordinal:e.order_ordinal,freeShipping:t.freeShipping,hasDiscount:t.currentDiscount>0,savedAmountText:l}})},[v,f,u,m.value]);return(0,a.jsxs)("div",{className:te,children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 justify-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(g.cD,{className:"inline shrink-0","aria-hidden":"true"}),(0,a.jsx)(g.o5,{className:(0,p.A)("flex",{uppercase:!x,"gap-1":x}),variant:"caption2-strong",component:"span",children:d(h,{...x?{referrer_name:(0,a.jsx)(e8.i,{name:x})}:{}})})]}),(0,a.jsxs)("button",{type:"button",className:"flex shrink-0 items-center gap-1",onClick:()=>s(!l),children:[(0,a.jsx)(g.o5,{variant:"caption2-strong",component:"span",className:"underline uppercase",children:d("javascript.build_your_own_box.voucher_details")}),l?(0,a.jsx)(g.Vh.Up,{}):(0,a.jsx)(g.Vh.Down,{})]})]}),l&&b&&b.length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("div",{className:"overflow-x-auto pb-2",children:(0,a.jsx)("div",{className:"flex w-max mx-auto gap-2 px-2",children:b.map((e,t)=>(0,a.jsxs)("div",{className:(0,p.A)("flex min-w-[150px] gap-1 shrink-0 items-center justify-center rounded-md border border-secondary-600 bg-secondary-200 p-2"),children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(e7._,{src:`${R.T.BASE_PREFIX_FUNNEL}/assets/voucher_${c}_box.svg`,alt:"breakdown"}),(0,a.jsx)("span",{className:"absolute left-[16px] top-[16px] text-xs font-bold text-neutral-700",children:e.ordinal})]}),(0,a.jsxs)("div",{className:"flex gap-1 items-center",children:[(e.hasDiscount||!e.freeShipping)&&(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(g.o5,{variant:"caption2-strong",className:"uppercase text-neutral-950",component:"span",children:d("javascript.plan.select_plan.box_settings_modal.voucher_up_to",{value:e.savedAmountText})}),(0,a.jsx)(g.o5,{variant:"caption2-regular",component:"span",className:"text-neutral-800",children:d("javascript.build_your_own_box.discounts_in_meals")})]}),e.freeShipping&&(0,a.jsxs)(a.Fragment,{children:[e.hasDiscount&&(0,a.jsx)(e9.A,{}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(g.o5,{variant:"caption2-strong",component:"span",children:d("plan.plan_summary.free_shipping_title")}),(0,a.jsx)(g.o5,{variant:"caption2-regular",component:"span",className:" text-neutral-800",children:d("javascript.accounts.orders.price_breakdown.shipping")})]})]})]})]},e.ordinal))})}),(0,a.jsx)(ta,{})]})]})},tn=({currentDiscount:e,freeShipping:t,type:l,promo:r})=>{let{t:n}=(0,P.B)(),{locale:s,currency:i,referrerName:o}=tl(),c=(0,J.T6)({communicationStyle:r.communication_style,promoType:l,currentDiscount:e,orderAmount:null,currencyValue:i.value,locale:s}),d=(0,J.lZ)(!!e,t,!1,o);return(0,a.jsxs)("div",{className:te,children:[(0,a.jsx)(g.cD,{className:"mr-1 inline shrink-0 align-middle","aria-hidden":"true"}),(0,a.jsx)(g.o5,{variant:"caption2-strong",component:"span",className:(0,p.A)({uppercase:!o}),children:n(d,{value:c,...o?{referrer_name:(0,a.jsx)(e8.i,{name:o})}:{}})}),!o&&(0,a.jsx)(a.Fragment,{children:"\xa0"}),(0,a.jsx)(ta,{className:(0,p.A)({inline:!o})})]})},ts=()=>{let{state:e}=(0,n.useContext)(w.BR),[t,l]=(0,n.useState)(!1),r=(0,en.z)(e);if(!r?.valid)return null;let{currentDiscount:s,freeShipping:i,splitVoucher:o,type:c}=(0,J.dl)({numberOfMeals:null,numberOfPortions:e.boxSettings?.numberOfPeople||tt,planPrice:null,promo:r});return s||i?o?(0,a.jsx)(tr,{currentDiscount:s,freeShipping:i,isExpanded:t,setIsExpanded:l,type:c}):(0,a.jsx)(tn,{currentDiscount:s,freeShipping:i,type:c,promo:r}):null},ti=({text:e})=>{let{t}=(0,P.B)(),{state:l}=(0,n.useContext)(i.B),{brandShort:r,countryLowercase:s,brandShortLowercase:c}=(0,o.PB)();return(0,n.useEffect)(()=>{(0,E.u4)({name:E.tL.buildYourOwnBoxEmptyListViewed,visitId:l?.uuid,brand:c,country:s})},[]),(0,a.jsxs)("div",{className:"xl:mx-20 mb-2 flex items-center gap-4 roun
1ded-container border border-neutral-200 bg-neutral-white p-4 mx-4 lg:mx-8",children:[(0,a.jsx)("img",{src:`${R.T.BASE_PREFIX_FUNNEL}/assets/IconNoRecipesBanner${r}.svg`,alt:t("spree.no_products_found")}),(0,a.jsx)(g.o5,{variant:"label-small-regular",className:"mt-1 text-neutral-charcoal",children:e})]})};var to=l(934);let tc=({name:e,smallSizeUrl:t,mediumSizeUrl:l,largeSizeUrl:r})=>{let[s,i]=(0,n.useState)(!0),o=l??r;return(0,a.jsxs)("div",{className:"grid w-full overflow-hidden bg-gray-100 md:h-[40dvh]","aria-live":"polite",children:[(0,a.jsx)("img",{src:t??eN,alt:e,className:"col-start-1 row-start-1 block h-auto w-full object-cover md:h-[40dvh] object-center",style:s&&o?{filter:"blur(4px)"}:void 0}),o&&(0,a.jsxs)("picture",{className:(0,p.A)("col-start-1 row-start-1 transition-opacity duration-200 ease-in-out",{"opacity-0":s,"opacity-100":!s}),children:[l&&r&&(0,a.jsx)("source",{media:`(min-width: ${to.$e.screenSizes.lg})`,srcSet:r}),(0,a.jsx)("img",{src:o,alt:e,onLoad:()=>i(!1),onError:()=>i(!1),className:"block h-auto w-full object-cover md:h-[40dvh] object-center"})]})]})};var td=l(2510),tu=l(786);let tp=()=>(0,a.jsx)("hr",{className:"mx-4 lg:mx-10 mt-8 h-px border-0 bg-neutral-100","aria-hidden":!0}),tm=Object.assign(({isOpen:e,onClose:t,modalId:l,children:r})=>{let{t:n}=(0,P.B)();return(0,a.jsx)(ew.l,{isOpen:e,closeDialog:t,modalId:l,noPadding:!0,hideCloseButton:!0,children:(0,a.jsxs)("div",{className:"h-[100dvh] overflow-auto",children:[(0,a.jsx)("div",{className:"absolute right-[6px] top-8 bg-neutral-white rounded-full z-1",children:(0,a.jsx)("button",{"aria-label":n("spree.close"),type:"button",onClick:t,className:"flex size-10 items-center justify-center rounded-full border-0 pb-[2px] pl-[2px]",children:(0,a.jsx)(td.I,{icon:"close",className:"text-xl text-neutral-700"})})}),r]})})},{Image:({children:e})=>(0,a.jsx)("div",{className:"bg-neutral-greyLight",children:e}),Body:({children:e,className:t})=>(0,a.jsx)("div",{className:(0,p.A)("rounded-t-2xl bg-neutral-white pb-8 pt-4 lg:pb-10 lg:pt-6",t),children:e}),Footer:({children:e})=>(0,a.jsxs)("div",{className:"sticky bottom-0",children:[(0,a.jsx)("div",{className:"w-full lg:hidden bg-neutral-white h-2 shadow-[0_-2px_8px_0_rgba(18,17,12,0.10)]","aria-hidden":!0}),(0,a.jsx)("div",{className:"shrink-0 bg-neutral-white p-4 lg:p-8 lg:pt-4 lg:rounded-2xl",children:e})]}),Divider:tp,Loading:({brand:e})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tp,{}),(0,a.jsx)("section",{className:"pt-8 px-4 lg:px-10",children:(0,a.jsx)(tu.k,{brand:e})})]}),Description:({heading:e,description:t})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tp,{}),(0,a.jsxs)("section",{className:"pt-8 px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"heading-medium-strong",component:"h2",className:"mb-4",children:e}),(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"whitespace-pre-line text-neutral-950",children:t})]})]})}),tx=({addon:e,isOpen:t,onClose:l,item:r})=>{let{t:n}=(0,P.B)(),{locale:s,brandShort:i,country:o}=(0,ea.P)(),{addItem:d}=D(),{data:u,isLoading:m}=(0,c.useQuery)(["addOnDetails",e?.id],()=>eL({id:e?.id,brandShort:i,country:o}),{enabled:!!e?.id&&t,onError:t=>{(0,M.LM)("Error fetching add-on details",{error:t instanceof Error?t.message:"Unknown error",addOnId:e?.id})}});if(!t||!e||!r)return null;let x=(0,ee.OY)(s),h=e.pricing?.total??0,f=e.isDiscounted?e.discountedPrice??h:h,v=e.isDiscounted&&f!==h;return(0,a.jsxs)(tm,{isOpen:t,onClose:l,modalId:"addon-details-modal",children:[(0,a.jsx)(tm.Image,{children:(0,a.jsx)(tc,{name:e.name,smallSizeUrl:e.image?.url,largeSizeUrl:u?.image?.url})}),(0,a.jsxs)(tm.Body,{className:(0,p.A)({"min-h-[60dvh]":!u}),children:[(0,a.jsxs)("div",{className:"px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"heading-large-strong",component:"h1",className:"font-serif text-neutral-950",children:e.name}),e.categories.length>0&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)(g.AA,{attributes:e.categories.map(e=>e.name)})}),(0,a.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,a.jsx)(g.o5,{variant:"heading-medium-strong",className:"text-neutral-950",children:(0,ee.Cv)(f,x.value,x.locale)}),v&&(0,a.jsx)(g.o5,{variant:"body-medium-regular",component:"span",className:"line-through text-neutral-700",children:(0,ee.Cv)(h,x.value,x.locale)})]})]}),m&&(0,a.jsx)(tm.Loading,{brand:i}),!m&&u?.description&&(0,a.jsx)(tm.Description,{heading:n("javascript.add_on_detail.description_heading"),description:u.description})]}),(0,a.jsx)(tm.Footer,{children:(0,a.jsxs)(g.$n,{variant:"primary",onClick:()=>{d("ADDON",r),l()},className:"w-full lg:w-48 mx-auto",children:[n("javascript.accounts.orders.edit_modal.add")," ",(0,ee.Cv)(f,x.value,x.locale)]})})]})},tg=`${R.T.BASE_PREFIX_FUNNEL}/images/not_found.jpg`,th=({isOnDemand:e})=>(0,a.jsxs)(e6,{children:[(0,a.jsx)(e1,{}),(0,a.jsx)(e4,{isOnDemand:e}),(0,a.jsx)(e3,{children:Array.from({length:13}).map((e,t)=>(0,a.jsx)(e2,{loading:!0},`recipe-placeholder-${t}`))})]}),tf=e=>e.map(Number).filter(Number.isFinite),tv=e=>({id:e.id,title:e.name,imageUrl:e.image.url||tg,isDiscounted:e.isDiscounted,totalPrice:e.pricing.total,discountedPrice:e.discountedPrice,eligibleForMovDiscounts:e.eligibleForMovDiscounts}),tb=({loading:e,addOns:t,addOnCategories:l,isOnDemand:r})=>{let{t:s}=(0,P.B)(),i=(0,n.useMemo)(()=>(0,M.fE)(),[]),o=(0,n.useMemo)(()=>
1{if("MARKETPLACE"!==i.get(M.lH.productCategory))return;let e=eq(i.get(M.lH.filters));if(!e||!e["0"])return;let t=tf(e["0"]);return t.length>0?t:void 0},[]),[c,d]=(0,n.useState)(o??[]),[u,p]=(0,n.useState)(null),m=t.filter(e=>0===c.length||e.categories.some(e=>c.includes(e.id))),x=(0,n.useMemo)(()=>[{key:"0",localizedName:s("accounts.edit_modal.findability.category"),values:l.map(e=>({valueKey:e.id.toString(),valueName:e.name}))}],[l,s]);return e?(0,a.jsx)(th,{isOnDemand:r}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(e6,{children:[(0,a.jsx)(eX,{filterCategories:x,preselectedFilters:{0:c.map(String)},onFiltersChange:e=>{d(Array.isArray(e?.[0])?tf(e[0]):[])},noOfResults:m.length,productCategory:"MARKETPLACE"}),(0,a.jsx)("div",{className:"lg:hidden mb-4 mx-4",children:(0,a.jsx)(eJ,{})}),(0,a.jsx)(ts,{}),(0,a.jsx)(e4,{isOnDemand:r}),(0,a.jsx)(e3,{children:m.map(e=>(0,a.jsx)(eK,{itemType:"ADDON",item:tv(e),addon:e,onProductTileClick:()=>p(e)},e.id))}),0===m.length&&(0,a.jsx)(ti,{text:s("spree.no_products_found")})]}),(0,a.jsx)(tx,{addon:u,item:u?tv(u):null,isOpen:null!==u,onClose:()=>p(null)})]})};var tj=l(5933);let t_=({onEditClick:e,defaultDeliveryFromDate:t})=>{let{state:l,showBundles:r}=(0,n.useContext)(i.B),{country:s}=(0,o.PB)(),u=(0,B.J)({country:l?.locale?.country??"us"}),p=l.location?.zipcode,{data:h}=(0,c.useQuery)(["stateCode",p,s],()=>(0,tj._j)(p,{iso:s}),{enabled:!!p,staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),f=(0,x.GP)((0,m.H)(l.boxSettings?.deliveryWeek??t??(0,d.Ge)()),"MMM d",{locale:u}),v=l.boxSettings?.numberOfPeople||2,{t:b}=(0,P.B)(),j=b(1===v?"javascript.plan.select_plan.box_settings_modal.number_people":"javascript.plan.select_plan.box_settings_modal.number_people_plural",{count:v}),_=p?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"sr-only",children:b("spree.zipcode")}),p,(0,a.jsx)("span",{className:"hidden min-[340px]:inline",children:h?` ${h}`:""})]}):null;return(0,a.jsx)(g.EF,{className:"md:max-w-[380px]",variant:r?"inverse":"default",onEdit:e,editLabel:b("spree.edit"),summaryAriaLabel:b("javascript.accounts.orders.edit_modal.delivery_week"),items:[f,j,_]})};var ty=l(9209),tw=l(9015),tN=l(9996);let tC=({iconsOnly:e=!1,activeProductCategory:t,onSelect:l,hasNoRTH:r=!1})=>{let{state:s}=(0,n.useContext)(w.BR),{countryLowercase:i}=(0,o.PB)(),{t:c}=(0,P.B)(),d="us"!==i||s.boxSettings?.numberOfPeople!==1,u=!r,m=(0,n.useMemo)(()=>[...d?[{mealCategory:"RTC",localizedName:c("javascript.build_your_own_box.product_filters.rtc.title"),icon:(0,a.jsx)(ty.A,{"aria-label":c("javascript.build_your_own_box.product_filters.rtc.title")})}]:[],...u?[{mealCategory:"RTH",localizedName:c("javascript.build_your_own_box.product_filters.rth.title"),icon:(0,a.jsx)(tw.A,{"aria-label":c("javascript.build_your_own_box.product_filters.rth.title")})}]:[],{mealCategory:"MARKETPLACE",localizedName:c("javascript.build_your_own_box.product_filters.add_ons.title"),icon:(0,a.jsx)(tN.A,{"aria-label":c("javascript.build_your_own_box.product_filters.add_ons.title")})}],[d,u]);return(0,a.jsx)("div",{className:(0,p.A)("grid grid-cols-3 items-center lg:flex lg:justify-center",{"justify-between gap-2 lg:mx-0 lg:gap-4":!e,"gap-2":e}),role:"tablist",children:m.map(r=>{let n=t===r.mealCategory;return(0,a.jsxs)("button",{role:"tab","aria-selected":n,onClick:()=>l(r.mealCategory),className:(0,p.A)("flex h-full flex-col items-center md:flex-row","justify-center gap-1 rounded-container border border-solid py-2 transition-colors md:gap-2","focus:outline-none focus-visible:bg-neutral-white focus-visible:text-neutral-black",e?"h-[32px] px-4":"px-2 md:px-6",n?"text-neutral-white border-neutral-black bg-neutral-charcoal shadow-[4px_4px_16px_0_rgba(0,0,0,0.05)]":"border-neutral-greyMaster hover:bg-neutral-greyUltraLight hover:text-neutral-black"),title:r.localizedName,children:[(0,a.jsx)("div",{className:(0,p.A)("size-4 transition-colors"),children:r.icon}),!e&&(0,a.jsx)(g.o5,{variant:"caption1-regular",children:r.localizedName})]},r.mealCategory||"all")})})};var tP=l(222);let tE=({movAmount:e,showError:t=!1})=>{let{t:l,stringifyTranslation:r}=(0,P.B)(),{locale:n}=(0,o.PB)(),s=(0,ee.OY)(n),i=e?(0,ee.Cv)(e,s.value,s.locale):"";return(0,a.jsx)("span",{className:(0,p.A)({"flash-bounce-error-text":t}),children:l("javascript.accounts.orders.edit_modal.mov_progress.begin.title",{minimum:(0,a.jsx)("b",{children:r(l("javascript.accounts.orders.edit_modal.mov_progress.begin.minimum",{amount:i}))})})})};var tA=l(1901);let tk=({movAmount:e})=>{let{t,stringifyTranslation:l}=(0,P.B)(),{locale:r}=(0,o.PB)(),n=(0,ee.OY)(r),s=e?(0,ee.Cv)(e,n.value,n.locale):"";return(0,a.jsx)(g.o5,{variant:"label-xsmall-regular",component:"div",children:t("javascript.accounts.orders.edit_modal.mov_progress.reached.title",{amount_reached:(0,a.jsx)(g.o5,{variant:"label-xsmall-strong",component:"span",children:l(t("javascript.accounts.orders.edit_modal.mov_progress.reached.amount_reached",{amount:s}))})})})},tO=`${R.T.BASE_PREFIX_FUNNEL}/images/not_found.jpg`,tS=({isOpen:e,onClose:t,onContinue:l,itemCount:r,onGoToRecipes:s,onGoToMarket:o,cartCtaMode:c})=>{let{state:d,dispatch:u}=(0,n.useContext)(i.B),{locale:p,brandShort:m,countryLowercase:x,brandShortLowercase:h}=(0,ea.P)(),{shoppingCart:f,addItem:v,removeItem:b,boxSettings:j,errorMessage:_,hasError:y}=D(),{virtualPrice:N,isLoading:A}=(0,eB.S)(f),{getMinimumOrderValue:k}=(0,C.N)(),O=(0,ee.OY)(p),{t:S,stringifyTranslation:L}=(0,P.B)(),I=eD(),T=eI(),B=eR(),R=0===r,z=R&&!f.itemsInitialized,F=j?.numberOfPeople??2,V=k(F),$=N?.movAmountLeft??(z?V:null),H=Object.values(f.recipes),U=Object.values(f.addOns),W=N?.discountDetails?.appliedDiscounts?.length?N.discountDetails.appliedDiscounts:null,K=W?.find(e=>"MEALS"===e.discountTarget)?.banner??null,q=W?.find(e=>"ADD_ONS"===e.discountTarget)?.banner??null,Q=()=>{t(),s()},Y=()=>{t(),o()},Z=(e,t)=>{(0,E.u4)({name:E.tL.cartAddButtonClicked,visitId:d.uuid,country:x,brand:h,snapshot:{itemType:e,itemId:t.id,source:"CART_DETAILS_MODAL",flow:(0,E.Qe)(d.signupMode)}}),v(e,t)},X=(e,t)=>{b(e,t.id)},G={title:S("javascript.accounts.orders.edit_modal.your_cart"),closeLabel:S("spree.close"),itemCount:r},et=R?{brandShort:m,labels:{title:S("javascript.accounts.orders.edit_modal.mov_box_empty.title"),description:S("javascript.accounts.orders.edit_modal.mov_box_empty.description",{browse_menu:(0,a.jsx)(g.$n,{typographyVariant:"label-medium-strong",type:"button",variant:"text",onClick:Q,children:S("javascript.accounts.orders.edit_modal.mov_box_empty.browse_menu")}),explore_market:(0,a.jsx)(g.$n,{typographyVariant:"label-medium-strong",type:"button",variant:"text",onClick:Y,children:S("javascript.accounts.orders.edit_modal.mov_box_empty.explore_market")})})}}:void 0,er=e=>{let t=null!=e.totalPrice?(0,a.jsx)(g.n7,{formattedRegularPrice:(0,ee.Cv)(e.totalPrice,O.value,O.locale),formattedDiscountedPrice:e.isDiscounted&&null!=e.discountedPrice?(0,ee.Cv)(e.discountedPrice,O.value,O.locale):void 0,isDiscounted:e.isDiscounted,units:S("javascript.accounts.orders.edit_modal.item.singular")}):void 0,l=e.eligibleForMovDiscounts&&q?q:void 0;return{id:e.id,imageUrl:e.imageUrl||tO,title:e.title,quantity:e.amount,spinnerMax:99,numberOfPortionsPerMeal:1,badge:null,priceElement:t,volumeDiscountTag:l,onQuantityChange:(t,l)=>{l>e.amount?Z("ADDON",e):l<e.amount&&X("ADDON",e)},onRemove:()=>(e=>{for(let t=0;t<e.amount;t++)X("ADDON",e)})(e)}},es=H.reduce((e,t)=>
1e+t.amount,0),ei=R?void 0:{title:S("javascript.accounts.orders.edit_modal.meals"),description:`(${L(S(1===es?"javascript.accounts.orders.edit_modal.servings.singular":"javascript.accounts.orders.edit_modal.servings.plural",{count:es}))})`,icon:(0,a.jsx)(ty.A,{className:"size-[16px]"}),emptyTitle:S("javascript.accounts.orders.edit_modal.hungry"),emptyCtaLabel:S("javascript.accounts.orders.edit_modal.explore_menu"),onEmptyCtaClick:Q,items:H.map(e=>{let t=e.isVariant&&e.variantName?`${L(S("accounts.orders.edit_modal.variants.custom_choice"))}: ${e.variantName}`:void 0,{displayPrice:l,originalPrice:r}=eM({id:e.id,pricePerPortion:T?e.pricePerPortion:null,recipeDiscounts:B}),n=eT({surface:"cart",itemKind:"recipe",isSaverRecipe:"CORE_DOWN"===e.recipeType,displayPrice:l,originalPrice:r,portionLabel:S("accounts.orders.price_breakdown.portion")},I),s=n?(0,a.jsx)(g.LF,{formattedCurrentPrice:n.formattedCurrentPrice,formattedStrikethroughPrice:n.formattedStrikethroughPrice,portion:n.portion,secondaryLine:n.secondaryLine}):void 0,i=e.extraFeesTotal??0,o=!s&&Math.abs(i)>0?{formattedAmount:`${i>0?"+":""}${(0,ee.Cv)(i,O.value,O.locale)}`,color:"CORE_DOWN"===e.recipeType?"tertiary":"secondary",unitsLabel:S("accounts.orders.edit_modal.variants.serving")}:void 0;return{id:e.id,imageUrl:e.imageUrl||tO,title:e.title,quantity:e.amount,spinnerMax:99,numberOfPortionsPerMeal:F,badge:(0,a.jsx)(g.Cg,{variant:"small",isCustom:e.isVariant,brand:m}),selectedVariantLabel:t,priceElement:s,extraFeesDisplay:o,onQuantityChange:(t,l)=>{l>e.amount?Z("RECIPE",e):l<e.amount&&X("RECIPE",e)},onRemove:()=>(e=>{for(let t=0;t<e.amount;t+=F)X("RECIPE",e)})(e)}}),headerBadge:K?(0,a.jsx)(g._X,{value:K}):void 0},eo=U.filter(e=>e.eligibleForMovDiscounts),ec=U.filter(e=>!e.eligibleForMovDiscounts),ed=R?void 0:{title:S("javascript.accounts.orders.edit_modal.add_ons"),description:`(${L(S(1===U.length?"javascript.accounts.orders.current_orders.items.singular":"javascript.accounts.orders.current_orders.items.plural",{count:U.length}))})`,icon:(0,a.jsx)(tN.A,{className:"size-[16px]"}),emptyTitle:S("javascript.accounts.orders.edit_modal.hungry"),emptyCtaLabel:S("javascript.accounts.orders.edit_modal.explore"),onEmptyCtaClick:Y,discountEligibleItems:eo.map(er),discountIneligibleItems:ec.map(er),showDiscountIneligibleSeparator:eo.length>0&&ec.length>0,discountIneligibleLabel:S("javascript.accounts.orders.edit_modal.not_eligible_items")},eu=!!V&&null!==$&&$>0,ep=eu?{amountLeft:$,amount:V,labels:{notStarted:(0,a.jsx)(tE,{movAmount:V}),inProgress:(0,a.jsx)(tA.z,{movAmount:V,movAmountLeft:$}),reached:(0,a.jsx)(tk,{movAmount:V})}}:void 0,em=N?.discountDetails?.discountProgressBanner,ex=R||!em?void 0:{title:em.title,subtitle:em.subtitle,progress:em.progress,stickyAppliedDiscounts:W??null,appliedDiscountsStable:W??null,enabled:!0,levelUnlockedMessage:e=>(0,a.jsx)(g.o5,{variant:"caption1-regular",children:S("javascript.accounts.orders.volume_discounts.level_unlocked",{target:e.toLowerCase()})})},eg=N?.discountDetails?.summaryItems??[],eh=R?void 0:{title:S("javascript.accounts.orders.edit_modal.order_summary"),items:eg.map(e=>({id:e.id,title:e.title,subtitle:e.subtitle,value:e.value,banner:e.banner,children:e.children?.map(e=>({id:e.id,title:e.title,subtitle:e.subtitle,value:e.value,banner:e.banner}))})),isLoading:A},ef=!!d.promo?.info?.isLoading,ev=d.promo?.info?.promoError||void 0,eb=(0,M.fE)().get(M.lH.voucher)||void 0,ej=()=>{let e=d.notifications?.find(e=>e.id.includes("promo_code_error"));e&&u(w.Te.RemoveNotification(e.id))},e_=N?.total??0,ey=Math.abs(N?.priceBreakdown?.find(e=>"DISCOUNT"===e.type)?.totalAmount??0),ew=ey>0?e_+ey:null,eN={price:{totalBeforeDiscount:ew,totalAfterDiscount:e_,currency:O.value,discount:ey,isLoading:A,formattedTotalBeforeDiscount:ew?(0,ee.Cv)(ew,O.value,O.locale):void 0,formattedTotalAfterDiscount:(0,ee.Cv)(e_,O.value,O.locale),formattedDiscount:ey>0?(0,ee.Cv)(ey,O.value,O.locale):void 0},cta:{label:"checkout"===c?S("javascript.build_your_own_box.recipe_bundle.checkout_cta"):S("javascript.plan.select_plan.cta"),onClick:()=>{ev&&(ej(),u(w.Te.UpdatePromoInfo({promoError:null}))),l()},disabled:eu},labels:{totalPriceLabel:S("javascript.accounts.orders.current_orders.total_price"),savedDiscountLabel:ey>0?L(S("javascript.accounts.orders.edit_modal.saved_discount",{discount:(0,ee.Cv)(ey,O.value,O.locale)})):void 0}},eC=!!N&&!y&&0===N.total&&null===N.discountDetails&&0===N.movAmountLeft&&0===N.priceBreakdown.length&&0===N.addOnsTotal&&0===N.shipmentTotal&&0===N.shippingCost&&0===N.subtotal;(0,n.useEffect)(()=>{eC&&(0,M.LM)("Unexpected price calculation error",{itemCount:r,numberOfPeople:F})},[eC]);let eP=async()=>{u(w.Te.RemovePromo()),(0,M.P9)(M.lH.voucher),ej();try{await el.A.gql.user.upsertVisit(d,{promotionCode:""})}catch(e){(0,M.LM)("upsertVisit failed on removing promo code from cart",{error:e?.message||"Unknown"})}},eE=(0,en.z)(d),eA=(0,n.useMemo)(()=>
1{if(!eE)return;let{splitVoucher:e,freeShipping:t,currentDiscount:l,type:a}=(0,J.dl)({promo:eE,planPrice:d.plan?.meal?.total||0,numberOfMeals:d.plan?.meal?.numberOfMeals||0,numberOfPortions:d.plan?.meal?.numberOfPortions||0});if(!l&&!t)return;let r=e?"javascript.plan.step_1.promotions.split_order_voucher":"javascript.plan.step_1.promotions.single_order_voucher";if(!l&&t)return L(S(`${r}.free_shipping`));let n="percentage"===a?`${l}%`:(0,ee.Cv)(l??0,O.value,p);return L(t?S(`${r}.combination`,{value:n}):S(`${r}.discount`,{value:n}))},[eE?.code,d.plan?.meal?.total,d.plan?.meal?.numberOfMeals,d.plan?.meal?.numberOfPortions,O.value]),ek=_||((N||A||z)&&!eC?void 0:S("generals.website_error.title"));return(0,a.jsx)(g.Z3,{isOpen:e,onClose:t,brand:m,header:G,recipes:ei,marketItems:ed,movProgress:ep,volumeDiscounts:ex,orderSummary:eh,emptyBox:et,footer:eN,errorMessage:ek,children:(0,a.jsx)(g.Z3.Voucher,{labels:{title:S("javascript.build_your_own_box.cart.voucher_title"),appliedTitle:S("javascript.build_your_own_box.cart.voucher_applied_title"),placeholder:S("javascript.build_your_own_box.cart.voucher_placeholder"),apply:S("javascript.build_your_own_box.cart.voucher_apply"),remove:S("spree.remove")},appliedVoucherDescription:eA,defaultCode:eb,isApplying:ef,error:ev,onApply:e=>{ej(),u(w.Te.UpdatePromoInfo({typedVoucherCode:e,promoError:null}))},brand:m,onRemove:eP})})},tL=(e,t)=>"us"!==e||1!==t,tI=({isOpen:e,onClose:t})=>{let{t:l}=(0,P.B)(),{state:r,dispatch:s}=(0,n.useContext)(w.BR),[i,d]=(0,n.useState)(r?.location?.zipcode??""),{countryLowercase:u,brandShortLowercase:p}=(0,o.PB)(),[m,x]=(0,n.useState)(r.delivery?.deliveryDetails?.city??""),[h,f]=(0,n.useState)(!1),{isValid:v}=Z(),b=r.boxSettings?.numberOfPeople??eo.x.numberOfPeople,{mutate:j,isLoading:y,data:N,reset:C,isError:A}=(0,c.useMutation)(()=>(0,_.sC)(r.uuid,i,r.locale,m,_.wL[b]),{onSuccess:e=>{(0,E.u4)({name:E.tL.boxSettingsLocationRetrieved,visitId:r.uuid,country:u,brand:p,snapshot:{amountOfWeeks:e.length}}),0!==e.length&&(s(w.Te.UpdateAddressParams({location:{zipcode:i}})),t())}}),k=void 0!==N&&0===N.length||A,O=()=>{v(i)?j():f(!0)};return(0,a.jsx)(ew.l,{isOpen:e,closeDialog:t,modalId:"enter-zipcode-modal",children:(0,a.jsxs)("div",{className:"flex flex-col max-h-[80dvh] lg:max-h-[90dvh]",children:[(0,a.jsx)("div",{className:"overflow-y-auto px-4 lg:px-8",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 pb-4",children:[(0,a.jsx)(g.o5,{component:"h2",variant:"title2",className:"text-center",children:l("javascript.plan.select_plan.box_settings_modal.where_to")}),(0,a.jsx)(g.o5,{component:"p",variant:"body-regular",className:"text-center",children:l("javascript.plan.select_plan.enter_zipcode_modal.description")}),(0,a.jsx)(X,{postalCode:i,onPostalCodeChange:e=>{e!==i&&(f(!1),C()),d(e)},selectedSuburb:m,onSuburbChange:x,showError:h||k,autoFocus:!0,showSuburbs:!1,errorMessage:k?l("javascript.plan.select_plan.week_selector.no_delivery"):void 0,showLabel:!0,onSubmit:O})]})}),(0,a.jsx)("div",{className:"shrink-0 bg-neutral-white p-4 lg:p-8 lg:pt-4",children:(0,a.jsx)(g.$n,{isLoading:y,disabled:k,variant:"primary",onClick:O,className:"w-full lg:w-48 mx-auto",children:l("javascript.plan.select_plan.enter_zipcode_modal.cta")})})]})})},tT=()=>{let{t:e}=(0,P.B)(),[t,l]=(0,n.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",className:"bg-information-light flex justify-center items-center py-3 px-4 text-information-dark rounded-b-2xl w-full border-none cursor-pointer",onClick:()=>l(!0),children:[(0,a.jsx)(g.o5,{variant:"caption1-regular",children:e("javascript.plan.select_plan.enter_zipcode_banner.text")}),(0,a.jsx)(g.Vh.Right,{})]}),(0,a.jsx)(tI,{isOpen:t,onClose:()=>l(!1)})]})},tD="recipe-bundle-preferences-list",tM=({preferences:e,selectedPreferenceId:t,onSelect:l})=>{let{t:r}=(0,P.B)(),[s,i]=(0,n.useState)(!0);(0,n.useLayoutEffect)(()=>{window.innerWidth<parseInt(to.$e.screenSizes.lg)&&i(!1)},[]);let o=(0,n.useMemo)(()=>{if(s)return e;let l=e.findIndex(e=>e.id===t);return l<4?e.slice(0,4):e.slice(0,3).concat(e[l])},[e,s]);if(0===e.length)return null;
1let c=e.length>4;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)("div",{id:tD,role:"radiogroup",className:"flex flex-wrap gap-2",children:o.map(e=>{let r=e.id===t;return(0,a.jsx)("button",{type:"button",role:"radio","aria-checked":r,onClick:()=>l(e.id),className:(0,p.A)("rounded-full border px-4 transition-colors h-8",r?"border-neutral-900 bg-neutral-900 text-neutral-00":"border-neutral-greyDim bg-neutral-00 hover:border-neutral-900 hover:bg-neutral-50"),children:(0,a.jsx)(g.o5,{variant:"label-small-regular",className:(0,p.A)(r&&"text-neutral-00 font-strong"),children:e.title})},e.id)})}),c?(0,a.jsx)("div",{className:(0,p.A)("ml-auto mr-0",s&&"lg:hidden"),children:(0,a.jsx)("button",{type:"button",onClick:()=>{i(e=>!e)},"aria-expanded":s,"aria-controls":tD,"aria-label":r(s?"javascript.build_your_own_box.recipe_bundle.preferences.show_less":"javascript.build_your_own_box.recipe_bundle.preferences.show_more"),className:"rounded-full border border-neutral-greyDim bg-neutral-00 px-2 h-8 hover:border-neutral-900 hover:bg-neutral-50",children:s?(0,a.jsx)(g.Vh.Up,{"aria-hidden":"true"}):(0,a.jsx)(g.Vh.Down,{"aria-hidden":"true"})})}):null]})},tB=({ingredient:e})=>(0,a.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,a.jsx)("div",{className:"size-20 overflow-hidden rounded-full bg-neutral-75",children:e.image.url?(0,a.jsx)("img",{src:e.image.url,alt:e.nameWithQuantity,className:"size-full object-cover"}):(0,a.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,a.jsx)(ef.A,{style:{scale:1.5}})})}),(0,a.jsx)(g.o5,{variant:"label-small-regular",className:"mt-2 text-neutral-700",children:e.nameWithQuantity})]}),tR=({recipe:e,isOpen:t,onClose:l})=>{let{t:r}=(0,P.B)(),{state:s}=(0,n.useContext)(w.BR),{brandShort:i,country:o,countryLowercase:u,brandShortLowercase:m}=(0,ea.P)(),{addItem:x}=D(),[h,f]=(0,n.useState)(0),v=(0,n.useMemo)(()=>e?e.recipeVariants.length>0?e.recipeVariants:[e]:[],[e]),b=!!(e&&e.recipeVariants.length>0),j=v[h]??e,{data:_,isLoading:y}=(0,c.useQuery)(["recipeDetails",j?.id],()=>(0,d.Pd)({id:j?.id,brandShort:i,country:o}),{enabled:!!j?.id&&t,onError:e=>{(0,M.LM)("Error fetching recipe details",{error:e instanceof Error?e.message:"Unknown error",recipeId:j?.id})}});if((0,n.useEffect)(()=>{t&&e&&(0,E.u4)({name:E.tL.recipeDetailsViewed,visitId:s.uuid,country:u,brand:m,snapshot:{recipeId:e.id,flow:(0,E.Qe)(s.signupMode)}})},[t,e?.id]),(0,n.useEffect)(()=>{if(e&&t)if(e.recipeVariants.length>0){let t=e.recipeVariants.findIndex(t=>t.id===e.id);f(t>=0?t:0)}else f(0)},[e,t]),!t||!e||!j)return null;let N=_?.assumedIngredients&&_.assumedIngredients.length>0||_?.utensils&&_.utensils.length>0,C=_?.shippedIngredients&&_.shippedIngredients.length>0,A=b?`${j.category.displayText} • ${r("accounts.orders.edit_modal.has_variants")}`:j.category.displayText,k=_?.nutritionalInformation?.filter(e=>null!==e.perPortion&&0!==e.perPortion)?.map(e=>`${e.name} ${e.perPortion} ${e.unit}`).join(", ");return(0,a.jsxs)(tm,{isOpen:t,onClose:l,modalId:"recipe-details-modal",children:[(0,a.jsx)(tm.Image,{children:(0,a.jsx)(tc,{name:j.title,...{mediumSizeUrl:j.image.url?.replace("/small/","/medium/"),largeSizeUrl:j.image.url?.replace("/small/","/large/")},smallSizeUrl:e?.image?.url})}),(0,a.jsxs)(tm.Body,{className:(0,p.A)({"min-h-[100dvh]":!_}),children:[(0,a.jsxs)("div",{className:"px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"heading-large-strong",component:"h1",className:"font-serif text-neutral-950",children:j.title}),j.subtitle?(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"mt-2 text-neutral-950",children:j.subtitle}):null,(0,a.jsx)("div",{className:"mt-2 flex flex-wrap items-baseline gap-2",children:(0,a.jsx)(ez,{recipe:j})}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(g.tZ,{attributes:j.attributes,dietType:A,dietaryAllergenIcons:j.dietaryAllergenIcons,heatLevelIcon:j.heatLevelIcon,recipeServingTime:j.recipeServingTime,recipeType:j.recipeType,extraFees:void 0,hasVariants:b})})]}),b&&e.recipeVariants.length>1&&(0,a.jsxs)("section",{className:"mt-8 lg:px-10",children:[(0,a.jsx)("div",{className:"mb-3 flex items-center justify-between px-4 lg:px-0",children:(0,a.jsx)(g.o5,{variant:"heading-medium-strong",component:"h2",children:r("javascript.dish_detail.customize_your_choice")})}),(0,a.jsx)(ey,{recipeVariants:e.recipeVariants,mobileLayout:"horizontal",selectedIndex:h,onSelectionChanged:f})]}),y&&(0,a.jsx)(tm.Loading,{brand:i}),!y&&_&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tm.Description,{heading:r("javascript.dish_detail.description_heading"),description:_.description}),!!j.recipeServingTime&&(0,a.jsxs)("section",{className:"pt-8 px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"label-xsmall-strong",component:"h2",className:"uppercase mb-2",children:r("javascript.dish_detail.serving_time")}
1),(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"whitespace-pre-line text-neutral-950",children:j.recipeServingTime})]}),!!_.difficulty&&(0,a.jsxs)("section",{className:"pt-8 px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"label-xsmall-strong",component:"h2",className:"uppercase mb-2",children:r("javascript.dish_detail.difficulty")}),(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"whitespace-pre-line text-neutral-950 capitalize",children:r(`javascript.dish_detail.difficulty_level.${_.difficulty.toLocaleLowerCase()}`)})]}),_.nutritionalInformation.length>0&&(0,a.jsxs)("section",{className:"pt-8 px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"label-xsmall-strong",component:"h2",className:"uppercase mb-2",children:r("javascript.dish_detail.nutrition_per_serving")}),(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"whitespace-pre-line text-neutral-950",children:k})]}),(0,a.jsxs)("section",{className:"pt-8 px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"label-xsmall-strong",component:"h2",className:"uppercase mb-2",children:r("javascript.dish_detail.allergens.heading")}),(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"whitespace-pre-line text-neutral-950",children:_.allergens.length>0?(0,a.jsxs)(a.Fragment,{children:[_.allergens.map(e=>e.name).join(", "),"."," ",r("javascript.dish_detail.allergens_other_traces")]}):r("javascript.dish_detail.allergens_traces")})]}),C&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tm.Divider,{}),(0,a.jsxs)("section",{className:"pt-8 px-4 lg:px-10",children:[(0,a.jsx)(g.o5,{variant:"heading-medium-strong",component:"h2",className:"mb-4",children:r("javascript.dish_detail.what_we_send")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-y-6 gap-x-4 justify-around",children:_.shippedIngredients.map((e,t)=>(0,a.jsx)("div",{className:"w-36",children:(0,a.jsx)(tB,{ingredient:e})},`${t}-${e.nameWithQuantity}`))})]})]}),N&&(0,a.jsx)("section",{className:"px-4 lg:px-10 mt-8",children:(0,a.jsxs)(g.vw,{footer:(0,a.jsx)(g.o5,{variant:"label-xsmall-regular",className:"text-center",children:r("javascript.dish_detail.wash_veggies")}),children:[_.assumedIngredients&&_.assumedIngredients.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(g.o5,{variant:"body-medium-strong",component:"h2",className:"mb-1",children:r("javascript.dish_detail.what_you_need")}),(0,a.jsx)("ul",{className:"list-decimal list-inside",children:_.assumedIngredients.map((e,t)=>(0,a.jsx)("li",{className:"w-full",children:(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"inline capitalize",children:e.name})},`${t}-${e.name}`))})]}),_.utensils&&_.utensils.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(g.o5,{variant:"body-medium-strong",component:"h2",className:"mb-1",children:r("javascript.dish_detail.what_you_use")}),(0,a.jsx)("ul",{children:_.utensils.map((e,t)=>(0,a.jsx)("li",{className:"w-full",children:(0,a.jsx)(g.o5,{variant:"body-medium-regular",className:"capitalize",children:e.name})},`${t}-${e.name}`))})]})]})}),_.chef&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tm.Divider,{}),(0,a.jsx)("section",{className:"pt-8 px-4 lg:px-10",children:(0,a.jsxs)("div",{className:"bg-information-100 rounded-2xl p-4 flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[_?.chef.avatar?.url?(0,a.jsx)("img",{src:_?.chef.avatar?.url,alt:_?.chef.name,className:"w-14 h-14 rounded-full object-contain bg-neutral-00"}):(0,a.jsx)("div",{className:"w-14 h-14 flex rounded-full items-center justify-center bg-neutral-00",children:(0,a.jsx)(ef.A,{style:{scale:1}})}),(0,a.jsxs)(g.o5,{variant:"body-medium-strong",children:[r("javascript.dish_detail.chef_heading"),(0,a.jsx)("div",{children:_.chef.name})]})]}),(0,a.jsx)(g.o5,{variant:"body-medium-regular",children:_.chef.quote})]})})]})]})]}),(0,a.jsx)(tm.Footer,{children:(0,a.jsx)(g.$n,{variant:"primary",onClick:()=>{e&&((0,E.u4)({name:E.tL.recipeDetailsAddButtonClicked,visitId:s.uuid,country:u,brand:m,snapshot:{recipeId:e.id,flow:(0,E.Qe)(s.signupMode)}}),x("RECIPE",b?eP(j):eC(e)),l())},className:"w-full lg:w-48 mx-auto",children:r("javascript.dish_detail_modal.add_meal")})})]})};var tz=l(1787),tF=l(7007);let tV={1:4,2:3,3:3,4:3,5:3,6:3},t$=({recipePreferences:e,numberOfPeople:t,deliveryWeek:l})=>{let{t:r,stringifyTranslation:s}=(0,P.B)(),{state:u}=(0,n.useContext)(i.B),{country:p,brandShort:m,locale:x,countryLowercase:h,brandShortLowercase:f}=(0,ea.P)(),{shoppingCart:v,addBundleRecipes:b}=D(),j=u.recipePreferences?.[0]??null,_=(0,n.useMemo)(()=>null!==j?e.find(e=>
1e.id===j)??e[0]:e[0],[j,e]),[y,N]=(0,n.useState)(null);(0,n.useEffect)(()=>{N(t=>null!==t&&e?.some(e=>e.id===t)?t:_?.id??null)},[_?.id,e]),(0,n.useEffect)(()=>{null!==j&&N(j)},[j]);let C=(0,n.useMemo)(()=>e.map(e=>e.id),[e]),A=(0,n.useMemo)(()=>[...C].sort((e,t)=>e-t).join(","),[C]),k="US"===p&&1===t?"RTH":"RTC",{data:O,isLoading:S,isSuccess:L}=(0,c.useQuery)(["topRecipesByPreferences","recipe-bundle",p,m,l??"",t,k,A],()=>(0,d.aZ)({country:p,brandShort:m,deliveryWeek:l,numberOfPeople:t,recipePreferenceIds:C,limitPerPreference:4,mealCategories:[k]}),{enabled:!!l&&t&&e.length>0}),I=(0,n.useMemo)(()=>O?.length?e.filter(e=>{let l=O.find(t=>t.recipePreference.id===e.id);return void 0!==l&&l.recipes.length>=tV[t]}):[],[O,e,t]);(0,n.useEffect)(()=>{L&&0!==I.length&&N(e=>null!==e&&I.some(t=>t.id===e)?e:I[0].id)},[L,I]);let T=(0,n.useMemo)(()=>{if(e.length)return I.length>0?I.find(e=>e.id===y)??I[0]:e.find(e=>e.id===y)??_},[e,y,_,I]),M=(0,n.useMemo)(()=>{if(!O?.length||!T)return[];let e=O.find(e=>e.recipePreference.id===T.id);return e?.recipes??[]},[O,T]),{virtualPrice:B,isLoading:R}=((e,t,l)=>{let{country:a,brandShort:r}=(0,o.PB)(),{state:s}=(0,n.useContext)(w.BR),i=(0,n.useMemo)(()=>e.map(e=>e.id).sort().join("-"),[e]),d=(0,er.iw)(s.signupMode),u=(0,en.z)(s),{data:p,isLoading:m}=(0,c.useQuery)(["getVirtualPrice","recipe-bundle",i,t,l,u?.code,d],()=>{let n;return(0,tz.B)({recipes:(n={},e.forEach(e=>{let l=eP(e);n[l.id]={...l,amount:t}}),{recipes:n,addOns:{},itemsInitialized:!0}).recipes,addOns:{},country:a,brandShort:r,deliveryDate:l,numberOfPeople:t,promotionData:u,orderingModel:d})},{enabled:e.length>0&&!!t&&!!l});return{virtualPrice:p,isLoading:m}})(M,t,l),[z,F]=(0,n.useState)(null),V=(0,n.useCallback)(e=>{F(e)},[]),$=(0,ee.OY)(x),H=B?.discountedItemTotal,U=B?.priceBreakdown.find(e=>"MEALS"===e.type)?.totalAmount,W=(U??0)>(H??0),K=B?.discountDetails?.appliedDiscountsWithPromotion?.find(e=>"MEALS"===e.discountTarget)?.discountValue,q=K?(0,tF.E)(K,x,2):null;if(!l||!e.length||L&&0===I.length||!T)return null;let Q=H?(0,ee.Cv)(H,$.value,$.locale):void 0,Y=U?(0,ee.Cv)(U,$.value,$.locale):void 0;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("section",{"aria-label":r("javascript.build_your_own_box.recipe_bundle.section_aria_label"),className:"w-full px-4 lg:px-8 xl:px-20 [&>div>div:first-child]:!p-0 mx-auto max-w-[1800px]",children:(0,a.jsxs)(g.vw,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 [&>*:not(:nth-child(3))]:px-4 [&>*:not(:nth-child(3))]:lg:px-8 pt-4 lg:pt-8",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsx)("div",{className:"ml-auto lg:order-1",children:null!==q?(0,a.jsx)(g._X,{value:s(r("javascript.build_your_own_box.recipe_bundle.save_amount",{amount:q}))}):null}),(0,a.jsxs)("h2",{children:[(0,a.jsx)(g.o5,{variant:"heading-medium-strong",component:"div",children:r("javascript.build_your_own_box.recipe_bundle.headline")}),(0,a.jsx)(g.o5,{variant:"heading-medium-regular",component:"div",children:r("javascript.build_your_own_box.recipe_bundle.headline_subtitle")})]})]}),(0,a.jsx)(tM,{preferences:I,selectedPreferenceId:T.id,onSelect:N}),(0,a.jsxs)("div",{className:"flex gap-3 overflow-x-auto pb-1 lg:grid lg:grid-cols-4 lg:gap-4 lg:overflow-visible lg:px-8",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"pl-1 lg:hidden"}),S?Array.from({length:4}).map((e,t)=>(0,a.jsx)(e2,{loading:!0,className:"h-[302px]"},`bundle-ph-${t}`)):M.map(e=>{let l=v.recipes[e.id]?.amount>0;return(0,a.jsx)("div",{className:"w-[calc(100vw-7rem)] md:w-[min(calc(100vw-7rem),280px)] shrink-0 lg:w-auto",children:(0,a.jsx)(eK,{hideCartControls:!0,itemType:"RECIPE",overwriteBadgeValue:l?r("javascript.accounts.orders.edit_modal.in_your_cart"):void 0,item:eC(e),recipe:e,people:t,onProductTileClick:()=>V({...e,recipeVariants:[]})})},e.id)}),(0,a.jsx)("span",{"aria-hidden":"true",className:"pr-1 lg:hidden"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col justify-between items-end pb-4 lg:pb-8 px-4 lg:px-8 lg:flex-row",children:[(0,a.jsx)("div",{className:"mb-6 lg:mb-0 w-full lg:w-auto",children:(0,a.jsx)("div",{className:"bg-neutral-00 p-1 rounded-sm text-center",children:(0,a.jsxs)(g.o5,{className:"text-neutral-700",variant:"label-small-regular",component:"div",children:[M.length," ",r("activerecord.models.recipe_plural")]})})}),(0,a.jsxs)("div",{className:"w-full lg:w-auto flex gap-4 justify-between lg:justify-end items-end lg:mt-2",children:[!R&&B&&(0,a.jsxs)("div",{"aria-live":"polite","aria-atomic":"true",children:[(0,a.jsx)(g.o5,{variant:"label-xsmall-regular",children:r("javascript.build_your_own_box.recipe_bundle.total_price")}),(0,a.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[(0,a.jsx)(g.o5,{variant:"heading-small-strong",children:Q}),Y&&W?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"sr-only",children:r("javascript.plan.select_plan.labels.original_price")}),(0,a.jsx)(g.o5,{variant:"label-small-regular",className:"text-neutral-greyDark line-through",children:Y})]}):null]})]}),(0,a.jsx)(g.$n,{type:"button",variant:"primary",disabled:!M.length||S||R,onClick:()=>
1{M.length&&(b(M.map(eP)),(0,E.u4)({name:E.tL.cartBundleAdded,visitId:u.uuid,country:h,brand:f}))},children:r("javascript.build_your_own_box.recipe_bundle.add_bundle")})]})]})]})}),(0,a.jsx)(tR,{recipe:z,isOpen:null!==z,onClose:()=>F(null)})]})};var tH="u">typeof document?n.useLayoutEffect:n.useEffect,tU=(e,t)=>{let l=tW(e);if(!t)return l;let a=tW(t);return{left:l.left-a.left,top:l.top-a.top,right:l.right-a.left,bottom:l.bottom-a.top,width:l.width,height:l.height}},tW=e=>{let t=e.getBoundingClientRect(),l=0,a=0,r=e.parentElement;for(;r;)l+=r.scrollLeft,a+=r.scrollTop,r=r.parentElement;let n=t.left+l,s=t.top+a;return{left:n,top:s,right:n+t.width,bottom:s+t.height,width:t.width,height:t.height}},tK=(e,t,l)=>{let a,r,n;return Math.min(((e,t)=>{let l=window.getComputedStyle(e).getPropertyValue(`scroll-padding-${t}`)||"0px";if("auto"===l)return 0;let a=`Unsupported scroll padding value, expected <length> or <percentage> value, received ${l}`;if(l.endsWith("px")){let e=parseInt(l);return tq(!Number.isNaN(e),a),e}if(l.endsWith("%")){let t=parseInt(l);return tq(!Number.isNaN(t),a),e.clientWidth/100*t}throw new tQ(a)})(e,l)+(a=window.getComputedStyle(t).getPropertyValue(`scroll-margin-${l}`)||"0px",r=`Unsupported scroll margin value, expected <length> value, received ${a}`,tq(a.endsWith("px"),r),tq(!Number.isNaN(n=parseInt(a)),r),n),tU(t,t.parentElement)[l])};function tq(e,t){if(!e)throw new tQ(t)}var tQ=class extends Error{constructor(e){super(`[react-snap-carousel]: ${e}`)}},tY=l(6983);let tZ=({title:e,description:t})=>(0,a.jsxs)("div",{className:"flex gap-3 items-center justify-center",children:[(0,a.jsx)(tY.A,{"aria-hidden":"true",className:"shrink-0",focusable:"false"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(g.o5,{component:"span",variant:"label-small-strong",children:[e," — "]}),(0,a.jsx)(g.o5,{component:"span",variant:"label-small-regular",children:t})]})]}),tX=({title:e,description:t})=>(0,a.jsxs)("li",{className:"flex w-full shrink-0 snap-center flex-col items-center px-6 text-center",children:[(0,a.jsx)(g.o5,{component:"p",variant:"label-small-strong",children:e}),(0,a.jsx)(g.o5,{className:"first-letter:uppercase",component:"p",variant:"label-small-regular",children:t})]}),tG=()=>{let{t:e}=(0,P.B)(),{scrollRef:t,pages:l,activePageIndex:r,goTo:s}=(({axis:e="x",initialPages:t=[]}={})=>{let l="x"===e?"width":"height",a="x"===e?"scrollWidth":"scrollHeight",r="x"===e?"clientWidth":"clientHeight",s="x"===e?"left":"top",i="x"===e?"right":"bottom",o="x"===e?"scrollLeft":"scrollTop",[c,d]=(0,n.useState)(null),[{pages:u,activePageIndex:p}
1,m]=(0,n.useState)({pages:t,activePageIndex:0}),x=(0,n.useCallback)(e=>{if(!c)return;if(Math.floor(c[a]-c[o])<=c[r])return void m({pages:e,activePageIndex:e.length-1});let t=Array.from(c.children),l=c.getBoundingClientRect(),n=e.map(e=>{let a=t[e[0]];tq(a instanceof HTMLElement,"Expected HTMLElement");let r=tK(c,a,s);return Math.abs(a.getBoundingClientRect()[s]-l[s]-r)}),i=Math.min(...n);m({pages:e,activePageIndex:n.indexOf(i)})},[c,r,s,a,o]),g=(0,n.useCallback)(()=>{let e;if(!c)return;let t=Array.from(c.children),a=c.getBoundingClientRect();x(t.reduce((t,r,n)=>{tq(r instanceof HTMLElement,"Expected HTMLElement");let o=t[t.length-1],d=tU(r,r.parentElement);if(!o||"true"===r.dataset.shouldSnap||d[i]-e>Math.ceil(a[l])){t.push([n]);let l=tK(c,r,s);e=d[s]-l}else o.push(n);return t},[]))},[x,c,l,i,s]);tH(()=>{g()},[g]),(0,n.useEffect)(()=>{let e=()=>{g()};return window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[g]),(0,n.useEffect)(()=>{if(!c)return;let e=()=>{x(u)};return c.addEventListener("scroll",e),()=>{c.removeEventListener("scroll",e)}},[x,u,c]);let h=(e,t)=>{if(!c)return;let l=u[e];if(!l)return;let a=Array.from(c.children)[l[0]];if(!(a instanceof HTMLElement))return;let r=tK(c,a,s),n=(null==t?void 0:t.behavior)||"smooth";c.scrollTo({behavior:n,[s]:tU(a,a.parentElement)[s]-r})},f=(0,n.useMemo)(()=>new Set(u.map(e=>e[0])),[u]);return{hasPrevPage:p>0,hasNextPage:p<u.length-1,prev:e=>{h(p-1,e)},next:e=>{h(p+1,e)},goTo:h,refresh:g,pages:u,activePageIndex:p,snapPointIndexes:f,scrollRef:d}})(),[i,o]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(l.length<=1||i)return;let e=setTimeout(()=>{s((r+1)%l.length)},6e3);return()=>clearTimeout(e)},[r,l.length,s,i]);let c=()=>o(!1);return(0,a.jsxs)("section",{className:"w-full mt-4 mb-8 lg:mt-6 lg:mb-10",children:[(0,a.jsx)(g.o5,{id:"quick-start-title",component:"h1",variant:"body-medium-strong",className:"mb-2 lg:mb-4 text-center uppercase",children:e("javascript.build_your_own_box.recipe_bundle.quick_start.title")}),(0,a.jsx)("div",{className:"mx-auto hidden max-w-4xl px-8 lg:grid lg:grid-cols-3 lg:gap-12",children:[1,2,3].map(t=>(0,a.jsx)(tZ,{title:e(`javascript.build_your_own_box.recipe_bundle.quick_start.items.item_${t}.title`),description:e(`javascript.build_your_own_box.recipe_bundle.quick_start.items.item_${t}.description`)},t))}),(0,a.jsxs)("div",{className:"lg:hidden",children:[(0,a.jsx)("ul",{ref:t,onPointerDown:()=>o(!0),onPointerUp:c,onPointerCancel:c,className:"flex snap-x snap-mandatory overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},role:"region","aria-labelledby":"quick-start-title",children:[1,2,3].map(t=>(0,a.jsx)(tX,{title:e(`javascript.build_your_own_box.recipe_bundle.quick_start.items.item_${t}.title`),description:e(`javascript.build_your_own_box.recipe_bundle.quick_start.items.item_${t}.description`)},t))}),(0,a.jsx)("div",{className:"mt-2 flex justify-center gap-2","aria-hidden":"true",children:l.map((e,t)=>(0,a.jsx)("span",{className:(0,p.A)("size-2 rounded-full transition-colors",t===r?"bg-neutral-800":"bg-neutral-200")},t))})]})]})},tJ=({count:e,onClick:t})=>{let{t:l}=(0,P.B)();return(0,a.jsxs)("button",{className:"relative flex items-center justify-center gap-1 p-2 lg:min-w-[133px] lg:justify-end",title:l("spree.shopping_cart"),onClick:t,"aria-label":l("spree.shopping_cart"),children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(tP.A,{}),e>0&&(0,a.jsx)("div",{className:"absolute right-0 top-0 size-2 rounded-full border border-neutral-00 bg-neutral-950"})]}),(0,a.jsx)(g.o5,{variant:"label-small-regular",className:"inline-flex items-center justify-center rounded-full border border-neutral-950 bg-neutral-800 p-1 text-neutral-white w-[40px] h-[24px]",children:e})]})},t0=({activeProductCategory:e,onSelectProductCategory:t,hasNoRTH:l,onContinue:r,isCartOpen:s,onOpenCart:i,onCloseCart:c,cartCtaMode:d,defaultDeliveryFromDate:u,recipePreferences:m})=>{let{t:x}=(0,P.B)(),{openBoxSettingsModal:h,itemCount:f}=D(),{countryLowercase:b}=(0,o.PB)(),{state:j,buildYourOwnBoxModalLess:_,showBundles:N}
1=(0,n.useContext)(w.BR),C=tL(b,j.boxSettings?.numberOfPeople),E=j.boxSettings?.numberOfPeople||eo.x.numberOfPeople;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("header",{className:"sticky top-0 w-full bg-neutral-white z-10 shadow-[0_2px_8px_0_rgba(0,0,0,0.04)]",children:[(0,a.jsx)("div",{className:"hidden lg:block",children:(0,a.jsx)(eJ,{})}),_&&!j.location?.zipcode&&(0,a.jsx)(tT,{}),(0,a.jsxs)("div",{className:"xl:px-20 mx-auto p-4 lg:px-8",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-y-3 lg:flex-nowrap lg:gap-x-8",children:[(0,a.jsx)("div",{className:"order-1 mr-auto mt-2 shrink-0 lg:mr-0",children:(0,a.jsx)(v.A,{asLinkToHomepage:!0})}),(0,a.jsx)("div",{className:"order-2 ml-auto shrink-0 lg:order-3 lg:ml-0",children:(0,a.jsx)(tJ,{count:f,onClick:i})}),(0,a.jsx)("div",{className:"order-3 hidden w-full lg:order-2 lg:flex lg:w-auto lg:flex-1 lg:justify-center",children:(0,a.jsx)(t_,{defaultDeliveryFromDate:u,onEditClick:h})})]}),N?null:(0,a.jsx)("div",{className:"mt-4 hidden w-full lg:mt-6 lg:block",children:(0,a.jsx)("div",{className:"flex justify-start overflow-x-auto lg:justify-center",children:(0,a.jsx)(tC,{activeProductCategory:e,onSelect:t,hasNoRTH:l})})})]})]}),N?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mx-auto p-4 flex w-full justify-center lg:hidden",children:(0,a.jsx)(t_,{defaultDeliveryFromDate:u,onEditClick:h})}),(0,a.jsx)(tG,{}),(0,a.jsx)(t$,{recipePreferences:m[y.Ko[E]],numberOfPeople:E,deliveryWeek:j.boxSettings?.deliveryWeek||u}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 text-center mt-10 lg:mt-14 mb-2 lg:mb-6 px-4",children:[(0,a.jsx)(g.o5,{component:"h2",variant:"heading-large-strong",children:x("javascript.build_your_own_box.recipe_bundle.your_mood.title")}),(0,a.jsx)(g.o5,{variant:"body-medium-regular",children:x("javascript.build_your_own_box.recipe_bundle.your_mood.description")})]})]}):null,(0,a.jsx)("div",{className:(0,p.A)("w-full bg-neutral-white",!N&&"lg:hidden"),children:(0,a.jsxs)("div",{className:"mx-auto p-4 lg:py-0 lg:pb-2",children:[N?null:(0,a.jsx)("div",{className:"flex w-full justify-center",children:(0,a.jsx)(t_,{defaultDeliveryFromDate:u,onEditClick:h})}),(0,a.jsx)("div",{className:"mt-4 w-full",children:(0,a.jsx)("div",{className:"flex justify-start overflow-x-auto lg:justify-center",children:(0,a.jsx)(tC,{activeProductCategory:e,onSelect:t,hasNoRTH:l})})})]})}),(0,a.jsx)(tS,{isOpen:s,onClose:c,onContinue:r,itemCount:f,onGoToRecipes:()=>t(C?"RTC":"RTH"),onGoToMarket:()=>t("MARKETPLACE"),cartCtaMode:d})]})};var t1=l(6608);let t2=({isOpen:e,closeDialog:t,modalId:l,recipeVariants:r,getVariantTimesAdded:s,onAddVariant:i,onRemoveVariant:o})=>{let{t:c}=(0,P.B)(),d=eI(),[u,p]=(0,n.useState)(0),m=r[u],x=m?.id?s?.(m.id)??0:0,v=()=>{if(!m?.id||!i)return;let e=x>0;i(m.id),e||t()};return e?(0,a.jsx)(h.e,{show:e,enter:"transition duration-100 ease-out",enterFrom:"scale-95 opacity-0",enterTo:"scale-100 opacity-100",leave:"transition duration-75 ease-out",leaveFrom:"scale-100 opacity-100",leaveTo:"scale-95 opacity-0",children:(0,a.jsx)(f.lG,{open:e,className:"fixed inset-0 z-[10001] overflow-y-auto",onClose:t,children:(0,a.jsxs)("div",{className:"flex min-h-screen items-start justify-center",children:[(0,a.jsx)(f.Xi,{className:"fixed inset-0 bg-neutral-charcoal opacity-70"}),(0,a.jsxs)("div",{className:"absolute bottom-0 flex size-full flex-col bg-neutral-white align-middle shadow-xl transition-all lg:relative lg:my-auto lg:max-w-2xl lg:rounded-2xl",id:l,children:[(0,a.jsx)("div",{className:"shrink-0 p-6 pt-8 pb-4 lg:px-12 lg:pb-0 lg:pt-12",children:(0,a.jsx)("button",{"aria-label":c("spree.close"),type:"button",onClick:t,className:"absolute right-2 top-2 mr-3 mt-2 flex size-[42px] items-center justify-center rounded-full border-0",children:(0,a.jsx)(t1.A,{"aria-hidden":"true"})})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-4 lg:px-12 lg:pb-10",children:(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{className:d?"flex flex-col gap-1":"flex flex-row gap-2",children:[(0,a.jsx)(g.o5,{variant:"title2",className:"mb-1 pr-6 md:pr-10",children:m?.title}),d&&m&&(0,a.jsx)(ez,{recipe:m})]}),(0,a.jsxs)("div",{className:"overflow-hidden max-lg:pl-1",children:[(0,a.jsx)(g.o5,{variant:"body-strong",className:"mb-3",children:c("javascript.dish_detail.customize_your_choice")}),(0,a.jsx)(ey,{recipeVariants:r,mobileLayout:"vertical",selectedIndex:u,onSelectionChanged:p})]})]})}),(0,a.jsx)("div",{className:"bottom-0 flex w-full flex-col-reverse gap-2 bg-neutral-white p-4 max-md:sticky md:flex-row md:place-content-between md:gap-4 md:px-8 md:py-6 lg:rounded-b-[12px] lg:px-8 lg:py-12",children:(0,a.jsx)("div",{className:"flex w-full justify-center",children:x>0?(0,a.jsxs)(g.VI,{ariaLabel:c("spree.amount"),className:"justify-center gap-4 roun
1ded bg-neutral-900 px-2 py-3 w-full text-neutral-00 md:min-w-[164px] md:max-w-[524px] lg:max-w-[248px]",children:[(0,a.jsx)(g.Yi,{onClick:()=>{m?.id&&o&&o(m.id)},ariaLabel:c("layouts.frontend.basket_tooltip.cart_tooltip.remove")}),(0,a.jsx)(g.D8,{variant:"body-medium-strong",children:x}),(0,a.jsx)(g.ES,{onClick:v,ariaLabel:c("spree.add")})]}):(0,a.jsx)(g.$n,{responsive:!0,variant:"primary",onClick:v,children:c("javascript.accounts.orders.edit_modal.add")})})})]})]})})}):null},t3=({isOnDemand:e})=>(0,a.jsxs)(e6,{children:[(0,a.jsx)(e1,{}),(0,a.jsx)(e4,{isOnDemand:e}),(0,a.jsx)(e3,{children:Array.from({length:13}).map((e,t)=>(0,a.jsx)(e2,{loading:!0},`recipe-placeholder-${t}`))})]}),t5=({isOpen:e,closeDialog:t,recipeVariants:l})=>{let{shoppingCart:r,addItem:n,removeItem:s,boxSettings:i}=D();return(0,a.jsx)(t2,{isOpen:e,closeDialog:t,recipeVariants:l,getVariantTimesAdded:e=>O(r.recipes[e]?.amount??0,i?.numberOfPeople),onAddVariant:e=>{let t=l.find(t=>t.id===e);t&&n("RECIPE",eP(t))},onRemoveVariant:e=>{s("RECIPE",e)}})},t4=({recipes:e,filterCategories:t,onFiltersChange:l,loading:r,preselectedFilters:s,productCategory:o,isOnDemand:c})=>{let d,u,{t:p}=(0,P.B)();(e=>{let t=eI(),{syncRecipePrices:l}=D();(0,n.useEffect)(()=>{t&&e?.length&&l(e.flatMap(e=>[{id:e.id,pricePerPortion:e.pricePerPortion},...e.recipeVariants.map(e=>({id:e.id,pricePerPortion:e.pricePerPortion}))]))},[t,e])})(e);let{boxSettings:m,openBoxNumberOfPeopleModal:x,openBoxSettingsModal:g}=D(),[h,f]=(0,n.useState)([]),[v,b]=(0,n.useState)(null),{buildYourOwnBoxModalLess:j,showBundles:_}=(0,n.useContext)(i.B),y=m?.numberOfPeople??eo.x.numberOfPeople,w=(0,n.useCallback)(e=>{b(e)},[]);return r?(0,a.jsx)(t3,{isOnDemand:c}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(e6,{children:[(0,a.jsx)(eX,{filterCategories:t,onFiltersChange:l,noOfResults:e.length||0,preselectedFilters:s,noPaddingTopDesktop:_,productCategory:o},JSON.stringify(t.map(e=>({key:e.key,values:e.values.map(e=>e.valueKey)})))+JSON.stringify(s)),(0,a.jsx)("div",{className:"lg:hidden mb-4 mx-4",children:(0,a.jsx)(eJ,{})}),(0,a.jsx)(ts,{}),(0,a.jsx)(e4,{isOnDemand:c}),e?.length!==0&&(0,a.jsx)(e3,{children:(d=[],u=new Set,e.forEach(e=>{let t=(e=>{if(0!==e.recipeVariants.length)return e.recipeVariants.map(e=>e.id).sort().join("-")})(e);t&&u.has(t)||(t&&u.add(t),d.push(e))}),d).map(e=>{let t=e.recipeVariants.length>0,l=t?e.recipeVariants.map(e=>e.id):void 0;return(0,a.jsx)(eK,{itemType:"RECIPE",item:eC(e),recipe:e,variantIds:l,onCustomizeClick:()=>((e,t)=>{if(t){if(m)return void f(e.recipeVariants);j?x({itemType:"RECIPE",items:[eC(e)],recipeVariants:e.recipeVariants}):g()}})(e,t),onProductTileClick:()=>w(e),people:y},e.id)})}),0===e.length&&(0,a.jsx)(ti,{text:p("accounts.orders.edit_modal.findability.none_found")})]}),(0,a.jsx)(t5,{isOpen:h.length>0,closeDialog:()=>f([]),recipeVariants:h}),(0,a.jsx)(tR,{recipe:v,isOpen:null!==v,onClose:()=>b(null)})]})};var t6=l(4053);let t7=()=>{let{state:e,buildYourOwnBoxModalLess:t}=(0,n.useContext)(i.B),{shoppingCart:l,clearCart:r,clearItem:s}=D(),{country:c}=(0,o.PB)(),u=eo.x.zipCode[c],{t:m}=(0,P.B)(),x=(0,eE.g)(),h=(0,t6.T)(l,e.boxSettings?.numberOfPeople||eo.x.numberOfPeople,e.boxSettings?.deliveryWeek||(t?x:(0,d.Ge)()),e.location?.zipcode||u,(0,er.bP)(e.signupMode)),f="INVALID"===h.status,v="INVALID"===h.status?h.invalidReason:null,b="INVALID"===h.status&&"ITEMS_UNAVAILABLE"===h.invalidReason?h.invalidItems:null,j=(0,n.useMemo)(()=>b?[...b.recipes.map(e=>e.title),...b.addOns.map(e=>e.title)]:[],[b]),_=(0,n.useCallback)(()=>{"PEOPLE_OR_WEEK_CHANGED"===v?r():"ITEMS_UNAVAILABLE"===v&&b&&(b.recipes.forEach(e=>s("RECIPE",e.id)),b.addOns.forEach(e=>s("ADDON",e.id)))},[v,b,r,s]),y="PEOPLE_OR_WEEK_CHANGED"===v,w="ITEMS_UNAVAILABLE"===v&&j.length>0,{descriptionKey:N,titleKey:C}=y?{descriptionKey:"javascript.plan.select_plan.cart_validation.switch_plan.description",titleKey:"javascript.plan.select_plan.cart_validation.switch_plan.title"}:{descriptionKey:"javascript.plan.select_plan.cart_validation.items_unavailable.description",titleKey:"javascript.plan.select_plan.cart_validation.items_unavailable.title"};return(0,a.jsx)(ew.l,{isOpen:f,closeDialog:_,modalId:"cart-validation-modal",hideCloseButton:!0,children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(g.o5,{component:"h3",variant:"title2",className:"text-center",children:m(C)}),(0,a.jsx)(g.o5,{component:"p",variant:"body-regular",className:(0,p.A)("text-center text-neutral-700",{"mb-6":y}),children:m(N)}),w&&(0,a.jsx)("ul",{className:"list-disc list-inside text-neutral-700 text-sm space-y-1 p-4",children:j.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(g.o5,{component:"span",variant:"body-regular",children:e})},e))}),(0,a.jsx)(g.$n,{variant:"primary",onClick:_,className:"w-full lg:w-48 mx-auto",children:m("javascript.accounts.switch_plan.summary_modal.confirm")})]})})},t8=({onContinue:e})=>{let{locale:t}=(0,ea.P)(),{shoppingCart:l,boxSettings:r,errorMessage:s,hasItems:i}=D(),{virtualPrice:o,isLoading:c}=(0,eB.S)(l),{getMinimumOrderValue:d}=(0,C.N)(),u=(0,ee.OY)(t),{t:p}
1=(0,P.B)(),[m,x]=(0,n.useState)(!1),h=r?.numberOfPeople??2,f=o?.discountedItemTotal??0,v=Math.abs(o?.priceBreakdown?.find(e=>"DISCOUNT"===e.type)?.totalAmount??0),b=v>0&&i?f+v:null,j=d(h),_=o?.movAmountLeft??j,y=!!j&&null!==_&&_>0,w=o?.discountDetails?.discountProgressBanner,N=o?.discountDetails?.appliedDiscounts,E=!y&&!!w;(0,n.useEffect)(()=>{let e;return m&&(e=setTimeout(()=>{x(!1)},1e3)),()=>{e&&clearTimeout(e)}},[m]);let A={totalAfterDiscount:f,totalBeforeDiscount:b,formattedTotalAfterDiscount:(0,ee.Cv)(f,u.value,u.locale),formattedTotalBeforeDiscount:b?(0,ee.Cv)(b,u.value,u.locale):void 0,isLoading:c,label:p("javascript.accounts.orders.current_orders.total_price"),shippingLabel:i?`+ ${p("javascript.plan.select_plan.shipping")}`:void 0},k=y&&j&&null!==_?{amount:j,amountLeft:_,labels:{notStarted:(0,a.jsx)(tE,{showError:m,movAmount:j}),inProgress:(0,a.jsx)(tA.z,{showError:m,movAmount:j,movAmountLeft:_}),reached:(0,a.jsx)(tk,{movAmount:j})}}:void 0,O=E&&w?{title:w.title,subtitle:w.subtitle&&!w.subtitle.startsWith("*")?`*${w.subtitle}`:w.subtitle,progress:w.progress,stickyAppliedDiscounts:N??null,appliedDiscountsStable:N??null,enabled:!0,levelUnlockedMessage:e=>(0,a.jsx)(g.o5,{variant:"caption1-regular",children:p("javascript.accounts.orders.volume_discounts.level_unlocked",{target:e.toLowerCase()})})}:void 0,S=(0,a.jsx)(g.$n,{type:"button",onClick:e,variant:"primary",className:"px-6 py-3",responsive:!0,ariaLabel:p("javascript.plan.select_plan.cta"),expanded:!0,children:p("javascript.plan.select_plan.cta")});return(0,a.jsx)(g.b1,{contentClassName:"xl:px-20",price:A,movProgress:k,volumeDiscounts:O,cta:S,errorMessage:s})};var t9=l(3114),le=l(4124),lt=l(1875);let ll=({recipePreferences:e,preselectedNumberOfPeople:t})=>{let l=(0,r.useRouter)(),{brand:p,countryLowercase:m,brandShortLowercase:x,country:g,brandShort:h}=(0,o.PB)(),{state:f,dispatch:v,buildYourOwnBoxModalLess:b}=(0,n.useContext)(i.B),j=(0,n.useMemo)(()=>(0,M.fE)(),[]),w=(0,er.bP)(f.signupMode)||j.get(M.lH.flow)===M.nd,N=f.recipePreferencesNames?.[0]??(0,u.k)(p),C=(0,n.useMemo)(()=>w?{}:(0,d.w_)(N),[N,w]),P=tL(m,f.boxSettings?.numberOfPeople),A=(({isEnteringOnDemandFlow:e,isOnDemand:t})=>e||t)({isEnteringOnDemandFlow:j.get(M.lH.flow)===M.nd,isOnDemand:w}),k=(0,n.useMemo)(()=>{let e=j.get(M.lH.productCategory);return"RTC"===e||"RTH"===e||"MARKETPLACE"===e?e:void 0},[]),[O,S]=(0,n.useState)(()=>k&&!("RTC"===k&&!P)?k:P?"RTC":"RTH"),[L,I]=(0,n.useState)(!1),[D,B]=(0,n.useState)("continue"),[R,z]=(0,n.useState)(!1);(0,n.useEffect)(function(){z((0,M.fE)().get(M.lH.flow)!==M.nd&&(0,le.c)()&&!(0,er.bP)(f.signupMode))},[]),(0,n.useEffect)(function(){if((0,M.fE)().get(M.lH.flow)===M.nd){(0,le.m)(),(0,M.P9)(M.lH.flow),"ON_DEMAND"!==f.signupMode&&v(s.T.SetSignupMode({mode:"ON_DEMAND"}));return}(0,er.cx)(f.signupMode)||v(s.T.SetSignupMode({mode:"BYOB"}))},[]),(0,n.useEffect)(t9.dZ,[]),(0,n.useEffect)(()=>{L&&(0,E.u4)({name:E.tL.cartDetailsModalView,visitId:f.uuid,country:m,brand:x,snapshot:{flow:(0,E.Qe)(f.signupMode)}})},[L]),(0,n.useEffect)(()=>{"RTC"!==O||P||S("RTH")},[P]);let[F,V]=(0,n.useState)(()=>{let e=eQ({urlFilters:eq(j.get(M.lH.filters)),preferenceFilters:C,skipPreferenceFilters:A});return{RTC:e,RTH:e,MARKETPLACE:{}}}),$=F[O];(0,n.useEffect)(()=>{if(j.get(M.lH.filters))return;let e=eQ({urlFilters:null,preferenceFilters:C,skipPreferenceFilters:A});V(t=>({...t,RTC:e,RTH:e}))},[N,A]);let H="RTH"===O?"RTH":"RTC",U=(0,n.useMemo)(()=>Object.keys($).map(e=>({key:e,values:$[e]})),[$]),W=eo.x.zipCode[f.locale.country],K=b?f.location?.zipcode||W:f.location?.zipcode,{data:q}=(0,c.useQuery)((0,_.mi)(f.uuid,K||"",f.delivery?.deliveryDetails?.city||"","RTH"),()=>(0,_.ZJ)(f.uuid,K||"",f.locale,f.delivery?.deliveryDetails?.city||"","RTH"),{enabled:"AU"===g}),Q=q?.firstDelivery?.initialItems?.length===0;(0,n.useEffect)(()=>{"RTH"===O&&Q&&S("RTC")},[Q]);let Y=(0,eE.g)(),Z=b?f.boxSettings?.deliveryWeek||Y:f.boxSettings?.deliveryWeek,X=f.boxSettings?.numberOfPeople||eo.x.numberOfPeople,{data:G}=(0,c.useQuery)(["getMenuRecipes",H,X,Z,U,w],()=>(0,d.Nj)({mealCategory:H,numberOfPeople:X,country:g,brandShort:h,recipeFilters:U,deliveryWeek:Z,isOnDemand:w}),{enabled:"MARKETPLACE"!==O&&(!b||!!Z)}),{data:J}=(0,c.useQuery)(["getMenuAddons",Z,K,X],()=>eS({country:g,brandShort:h,deliveryDate:Z,zipcode:K,numberOfPeople:X}),{enabled:!!K&&!!Z&&"MARKETPLACE"===O}),ee="MARKETPLACE"!==O,et="MARKETPLACE"===O,ea=(0,n.useCallback)((e="continue")=>{if(!f.visit?.step2At){let e=new Date;el.A.gql.user.upsertVisit(f,{step2At:e},f?.locale),v(s.T.UpdateVisit({...f.visit,step2At:e}))}B("continue"===e||"checkout"===e?e:"continue"),I(!0)},[]),en=(0,n.useCallback)(()=>{B("continue"),I(!1)},[]),es=(0,n.useCallback)(()=>{ea("checkout")},[]);
1return(0,a.jsxs)(T,{boxSettings:f.boxSettings,recipePreferences:e,onBundleAdded:es,children:[(0,a.jsx)(t7,{}),R&&(0,a.jsx)(lt.d,{}),(0,a.jsx)(t0,{defaultDeliveryFromDate:Y,activeProductCategory:O,onSelectProductCategory:S,hasNoRTH:Q,onContinue:()=>{if(!f.boxSettings){if(!Z)return void(0,M.LM)("User proceeding to delivery details without delivery week");v(s.T.UpdateBoxSettings({numberOfPeople:X,deliveryWeek:Z}));let t=e[y.Ko[X]].find(e=>e.name===(0,u.k)(p));v(s.T.UpdateRecipePreferences([{id:t.id,name:t.name}]))}f.location?.zipcode||v(s.T.UpdateAddressParams({location:{zipcode:K}})),v(s.T.CompleteStep(1));let t=f.visit?.step3At||new Date;el.A.gql.user.upsertVisit(f,{...f.location?.zipcode?{zipcode:K}:void 0,step3At:t,numberOfPersons:X},f?.locale),v(s.T.UpdateVisit({...f.visit,step3At:t})),l.push((0,er.bP)(f.signupMode)?"/select-location":"/delivery-details")},isCartOpen:L,onOpenCart:ea,onCloseCart:en,cartCtaMode:D,recipePreferences:e}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-4",children:[ee?(0,a.jsx)(t4,{loading:!G,recipes:G?.recipes||[],filterCategories:G?.filterCategories||[],onFiltersChange:e=>{V(t=>({...t,[O]:e}))},preselectedFilters:$,productCategory:O,isOnDemand:w}):null,et?(0,a.jsx)(tb,{loading:!J,addOns:J?.addOns||[],addOnCategories:J?.addOnCategories||[],isOnDemand:w}):null,(0,a.jsx)(t8,{onContinue:ea})]}),(0,a.jsx)(eh,{recipePreferences:e,preselectedNumberOfPeople:t}),(0,a.jsx)(eO,{})]})};var la=l(9893),lr=l(1029),ln=l(7454),ls=!0;let li=function({plansAndRecipePreferences:e,region:t,networkError:l}){let{dispatch:s}=(0,n.useContext)(w.BR),{asPath:i,replace:d}=(0,r.useRouter)(),{brand:u,brandShort:p}=(0,o.PB)(),{data:m}=(0,c.useQuery)(["mealPlans"],()=>(0,lr.y)(t),{initialData:e,enabled:"MS"===p}),x=m?.recipePreferences;(0,n.useEffect)(()=>{s(w.Te.UpdateServerSideNetworkError(l||void 0))},[]),(0,n.useEffect)(()=>{let e=((e,t)=>{if("MS"===e)return null;let l=t?.indexOf("?")??-1,a=l>=0&&t?t.slice(l):"";return{destination:`/select-plan${a}`,permanent:!1}})(p,i);e&&d(e.destination)},[p,i,d]);let{t:g}=(0,P.B)(),h=(0,M.Lq)(u);return"MS"!==p?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(la.A,{title:(0,ln.G)(g,"build-your-own-box"),metaData:[{name:"keywords",content:g("layouts.frontend.meta.keywords.select-plan")},{name:"description",content:g("layouts.frontend.meta.description.select-plan")}],customMetaData:[{property:"og:title",content:g("layouts.frontend.meta.title.build-your-own-box")},{property:"og:description",content:g("layouts.frontend.meta.description.select-plan")},{property:"og:image",content:`https://${t.url.replace(/^funnel./,"")}/images/${t.brandShort.toLowerCase()}/sharing/logo.png`},{property:"og:site_name",content:h},{property:"og:locale",content:t.locale},{property:"og:url",content:`${t.url.replace(/^funnel./,"")}/build-your-own-box`},{property:"fb:app_id",content:(0,M.fY)()}]}),x?(0,a.jsx)(ll,{recipePreferences:x}):null]})}},9015:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var a,r=l(4232);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let s=function(e){return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none"},e),a||(a=r.createElement("path",{fill:"currentColor",d:"M13 2H3a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1m0 11H3V3h10zM4.5 4.75a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0m2.75 0a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0m2.75 0a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0m1.5 1.75h-7A.5.5 0 0 0 4 7v4.5a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5V7a.5.5 0 0 0-.5-.5M11 11H5V7.5h6z"})))}},9209:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var a,r=l(4232);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let s=function(e){return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none"},e),a||(a=r.createElement("path",{fill:"currentColor",d:"M15.108 6.857a3.6 3.6 0 0 0-.474-1.435 3.6 3.6 0 0 0-1.018-1.119 3.6 3.6 0 0 0-2.368-.67A3.62 3.62 0 0 0 8 1.622a3.6 3.6 0 0 0-3.247 2.013 3.58 3.58 0 0 0-2.368.67 3.63 3.63 0 0 0-1.34 4.057 3.6 3.6 0 0 0 1.825 2.124v2.766c0 .3
101.118.584.331.797.211.21.501.33.8.33H12a1.13 1.13 0 0 0 1.128-1.127v-2.764a3.61 3.61 0 0 0 1.977-3.63zm-9.9 6.266a1.077 1.077 0 0 1-1.077-1.077v-.813c0-.2.172-.353.372-.353h6.996c.2 0 .372.153.372.353v.812c0 .595-.483 1.078-1.078 1.078zm8.55-5.145q-.154.48-.492.857a2.37 2.37 0 0 1-1.763.79.543.543 0 0 1-.526-.675l.135-.545a.627.627 0 1 0-1.219-.303l-.287 1.15a.494.494 0 0 1-.974-.12v-.878a.63.63 0 0 0-1.258 0v.878a.494.494 0 0 1-.974.12l-.288-1.15a.628.628 0 1 0-1.219.304l.136.544a.543.543 0 0 1-.526.674c-.335 0-.66-.07-.966-.207a2.35 2.35 0 0 1-.797-.582 2.38 2.38 0 0 1-.592-1.84 2.38 2.38 0 0 1 .975-1.67q.41-.295.905-.397c.19-.039.349.13.349.323a.63.63 0 0 0 1.257 0c0-.632.246-1.228.695-1.677a2.35 2.35 0 0 1 1.678-.695c.634 0 1.228.246 1.675.695.447.447.695 1.043.695 1.677a.63.63 0 0 0 1.258 0c0-.193.159-.362.348-.323a2.36 2.36 0 0 1 1.571 1.128 2.38 2.38 0 0 1 .21 1.922z"})))}},9996:(e,t,l)=>{"use strict";l.d(t,{A:()=>s});var a,r=l(4232);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)({}).hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(null,arguments)}let s=function(e){return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none"},e),a||(a=r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.625 1.873c.214 0 .423.061.603.175l.075.052.071.058c.137.122.241.275.306.446l.028.086.895 3.138.002.01a.6.6 0 0 1 .02.116l.001.03.001.016v1a2.63 2.63 0 0 1-1 2.061V13.5a.627.627 0 0 1-.627.627H3a.627.627 0 0 1-.627-.627V9.061a2.63 2.63 0 0 1-1-2.061V5.983l.007-.073.003-.019.012-.053.002-.01.897-3.138c.067-.234.208-.441.403-.588l.074-.053c.18-.114.388-.175.601-.176zM6 8.701a2.65 2.65 0 0 1-1.99.924c-.203.002-.383.156-.383.36v2.222c0 .368.298.667.667.667h7.412a.667.667 0 0 0 .667-.667V9.984c0-.203-.18-.357-.383-.358A2.65 2.65 0 0 1 10 8.7a2.627 2.627 0 0 1-4 0M2.627 7l.006.135a1.37 1.37 0 0 0 .611 1.011q.068.03.126.074a1.375 1.375 0 0 0 1.601-.249c.226-.225.364-.521.396-.836L5.373 7A.373.373 0 0 0 5 6.627H3A.373.373 0 0 0 2.627 7m4 0 .006.135A1.374 1.374 0 0 0 9.373 7 .373.373 0 0 0 9 6.627H7A.373.373 0 0 0 6.627 7M11 6.627a.373.373 0 0 0-.373.373 1.374 1.374 0 0 0 2.002 1.22.6.6 0 0 1 .126-.074A1.37 1.37 0 0 0 13.373 7 .373.373 0 0 0 13 6.627zM3.073 4.523a.667.667 0 0 0 .641.85h8.572a.667.667 0 0 0 .641-.85l-.26-.912a.67.67 0 0 0-.641-.484H3.975a.67.67 0 0 0-.641.484z",clipRule:"evenodd"})))}}},e=>{e.O(0,[701,655,641,69,742,32,51,636,593,792],()=>e(e.s=5678)),_N_E=e.O()}]);

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.