PageSourceSearch

https://www.hellofresh.fr/_next/static/chunks/62762-549a5b678918e8df.js

js hellofresh.fr collected 2026-09-24 22:24:44 UTC 110,336 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[62762,13630,4600],{473962:function(e,t,r){r.d(t,{_0:function(){return p},eH:function(){return s},W0:function(){return d},ZP:function(){return tz}});var n,o,i,a,u,c,l,s,d,p,f=r(687800),m=r(827378),h=r(184883),g=r(602307),b=r(783045),v=r(389905),y=r(718583),w=r(768587),P=r(887824),x=r(553911),O=r(164528),S=r(958042),k=r(449551),C=r(340332),D=function(e){var t=(0,k.Z)(),r=(0,S.Z)();return(0,m.useMemo)(function(){return(0,C.xG)(100*e,{locale:r,country:t,decimals:2})},[e,r,t])},j="features.checkout-drawer-order-summary",Z="features.checkout-drawer-order-summary.recipes-people",_="features.checkout_drawer_order_summary.price_reduced_from_accessibility_label",A="features.checkout-drawer-order-summary.shipping.title",E="features.checkout-drawer-order-summary.total.title",I="features.checkout-drawer-order-summary.promo-code",T="features.checkout-drawer-order-summary.promo-code.placeholder",F="features.checkout-drawer-order-summary.free.text",B={DELIVERY_BOX:"https://cdn.hellofresh.com/funnel/order-summary/hf-box-icon.png",DISCOUNT:"https://cdn.hellofresh.com/funnel/order-summary/percentage-icon.png",FREE_SHIPPING:"https://cdn.hellofresh.com/funnel/order-summary/hf-truck-icon.png"},V="features.checkout-drawer-order-summary.order-review-promo-applied-title",M=r(567921),W=r.n(M),U=r(786282),X=r(973524),R=r(496329),L=r(962928),N=function(e){var t=e.dataTestId,r=e.title,n=e.text,o=(0,b.zv)();return(0,f.tZ)(w.xu,{"data-test-id":t,style:{marginLeft:"-16px",marginRight:"-16px"},display:"flex",flexDirection:"column",backgroundColor:o?"alias.benefits.default":"shared-alias.positive.background.light",px:"global.sm-1",py:"global.xs",mt:"global.sm-1",children:(0,f.BX)(w.xu,{display:"flex",children:[(0,f.tZ)(w.xu,{alignSelf:"center",justifySelf:"center",mr:"xs",children:(0,f.tZ)(L.Z,{color:"#242424"})}),(0,f.BX)(w.xv,{textAlign:"left",color:"neutral.800",children:[(0,f.tZ)(w.xv,{as:"span",type:o?"body-md-bold":"body-sm-bold",children:"".concat(r," ")}),(0,f.tZ)(w.xv,{as:"span",type:"body-sm-regular",children:n})]})]})})},G=r(318066),H=r(277425);function q(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}var J=(0,w.q)(w.xu),z=function(){var e,t,r=(0,w.q_)({from:{opacity:.33},to:(e=function(e){return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,function(t){switch(t.label){case 0:return[4,e({opacity:.8})];case 1:return t.sent(),[4,e({opacity:.33})];case 2:return t.sent(),[2]}})},t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){q(i,n,o,a,u,"next",e)}function u(e){q(i,n,o,a,u,"throw",e)}a(void 0)})},function(e){return t.apply(this,arguments)}),config:{duration:1e3,easing:w.Gk.linear},loop:!0});return(0,f.BX)(w.xu,{display:"flex",gap:"global.sm-1",pt:"global.sm-2",children:[(0,f.tZ)(w.xu,{children:(0,f.tZ)(J,{"data-test-id":"order-summary-drawer-placeholder",backgroundColor:"alias.elevation.alternative.default",height:44,width:46,margin:"auto",borderRadius:"global.sm",style:r})}),(0,f.BX)(w.xu,{width:"100%",display:"flex",flexDirection:"column",gap:"global.xs",children:[(0,f.tZ)(J,{"data-test-id":"order-summary-drawer-placeholder",backgroundColor:"alias.elevation.alternative.default",height:24,width:"100%",margin:"auto",borderRadius:"global.sm",style:r}),(0,f.tZ)(J,{"data-test-id":"order-summary-drawer-placeholder",backgroundColor:"alias.elevation.alternative.default",height:12,width:"100%",margin:"auto",borderRadius:"global.sm",style:r})]})]})},$=function(e){var t=e.headline,r=e.description,n=e.altText,o=e.imageSrc,i=void 0===o?"":o;return e.isLoading?(0,f.tZ)(z,{}):(0,f.BX)(w.xu,{"data-test-id":"image-info-banner",pt:"global.sm-2",display:"flex",gap:"global.xs",children:[i&&(0,f.tZ)(G.ZP,{alt:n,width:"48",height:"48",src:(0,H.Z)(i)}),(0,f.BX)(w.xu,{textAlign:"left",marginY:"auto",children:[(0,f.tZ)(w.xv,{strong:!0,as:"p",mb:"global.xxs",children:t}),r&&(0,f.tZ)(w.xv,{as:"p",type:"body-xs-regular",children:r})]})]})};function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var K=function(e){var t,r,n,o,i,a,u,c,l,s,d,p,h,g,b=e.productSku,y=e.voucherCode,w=e.showNewSummaryUI,P=(0,O.ZP)(j).translateRaw,x=(0,X.Z)({voucherCode:y}),S=x.lifetimeVoucherInfo,k=x.multiWeekVoucherInfo,C=!!(null==S?void 0:S.isEligible),D=m.useMemo(function(){return"1"===W().get("hf_ssr_e_gift_card_purchase")},[]),Z=y||"",_=(0,U.m)({productSkus:[b],voucherCode:Z},{enabled:!!Z&&!!b,suspense:!1}),A=_.data,E=_.isLoading,I=(0,R.Z)(),T=null==A?void 0:null===(g=A.presets)||void 0===g?void 0:g[b],F=!!(null==S?void 0:S.isEligible),B=!!(null==k?void 0:k.isEligible),V=(null==T?void 0:T.reactivation_free_addon_lifetime_offer_title)||"",M=(null==T?void 0:T.reactivation_free_addon_lifetime_offer_description)||"",L=(null==T?void 0:T.reactivation_free_addon_limited_time_offer_title)||"",G=(null==T?void 0:T.reactivation_free_addon_limited_time_offer_description)||"",H=(r=(t={isLifetimeOffer:F,isLimitedTimeOffer:B,ppsFreeAddonLifetimeOfferTitle:V,ppsFreeAddonLimitedTimeOfferTitle:L}).isLifetimeOffer,n=t.isLimitedTimeOffer,o=t.ppsFreeAddonLifetimeOfferTitle,i=t.ppsFreeAddonLimitedTimeOfferTitle,a=(0,O.ZP)(j).translateRaw,r&&o?{cartSummaryDescriptionTitle:o}:n&&i?{cartSummaryDescriptionTitle:i}:r?{cartSummaryDescriptionTitle:a("reactivations.freeAddon.title.lifetime_copy")}:n?{cartSummaryDescriptionTitle:a("reactivations.freeAddon.title.weeks_copy")}:{cartSummaryDescriptionTitle:null}).cartSummaryDescriptionTitle,q=(c=(u={isLifetimeOffer:F,isLimitedTimeOffer:B,ppsFreeAddonLifetimeOfferDescription:M,ppsFreeAddonLimitedTimeOfferDescription:G,multiWeekVoucherInfo:k}).isLifetimeOffer,l=u.isLimitedTimeOffer,s=u.ppsFreeAddonLifetimeOfferDescription,d=u.ppsFreeAddonLimitedTimeOfferDescription,p=u.multiWeekVoucherInfo,h=(0,O.ZP)(j).translateRaw,c&&s?{cartSummaryDescriptionText:s}:l&&d?{cartSummaryDescriptionText:d}:c?{cartSummaryDescriptionText:h("reactivations.freeAddon.bodyText.lifetime_copy")}:l?{cartSummaryDescriptionText:h("reactivations.freeAddon.bodyText.weeks_copy",{numOfFreeWeeks:null==p?void 0:p.numberOfWeeks})}:{cartSummaryDescriptionText:null}).cartSummaryDescriptionText,J=(I?H||V:null==T?void 0:T.funnel_cart_summary_free_addon_title)||"",z=(I?q||M:null==T?void 0:T.funnel_cart_summary_free_addon_text)||"",K=(0,v.D)().freeAddOnImage,Q=null==T?void 0:T.funnel_cart_summary_free_addon_title_copy,ee={altText:"Image of free menu item",imageSrc:(null==T?void 0:T.funnel_cart_summary_free_addon_image)||K,isLoading:E};if(D||!(F||B))return null;if(w&&Q)return(0,f.tZ)($,Y({headline:Q,description:P("features.checkout-drawer-order-summary.free-addon-description")},ee));if(J||z)return w?(0,f.tZ)($,Y({headline:J,description:z},ee)):(0,f.tZ)(N,{dataTestId:"order-summary-drawer-container-free-add-on-text-price-presentation",title:J,text:z});if((null==k?void 0:k.isEligible)&&(null==k?void 0:k.numberOfWeeks)){var et=P("features.checkout-drawer-order-summary.freeAddOn-title-mwd",{numOfFreeWeeks:null==k?void 0:k.numberOfWeeks}),er=P("features.checkout-drawer-order-summary.freeAddOn-subtitle-mwd",{numOfFreeWeeks:null==k?void 0:k.numberOfWeeks});return w?(0,f.tZ)($,Y({headline:et,description:er},ee)):(0,f.tZ)(N,{dataTestId:"order-summary-drawer-container-free-add-on-text-multiple-week",title:et,text:er})}if(C){var en=P("features.checkout-drawer-order-summary.freeAddOn-title"),eo=P("features.checkout-drawer-order-summary.freeAddOn-subtitle");return w?(0,f.tZ)($,Y({headline:en,description:eo},ee)):(0,f.tZ)(N,{dataTestId:"order-summary-drawer-container-free-add-on-text",title:en,text:eo})}return null},Q=function(e,t){return t?(0,f.tZ)(w.$j,{variant:"primary","data-test-id":"fetching-price-spinner"}):e},ee=function(e){return e.replace(/<br\s*\/?>/gi," ").replace(/<[^>]*>/g,"")},et=function(e,t,r){var n=e/4,o=D(t/n),i=D(r/n);return{daysPerWeek:n.toString(),pricePerDay:o,discountedPricePerDay:i}},er=r(736026),en=r(513630),eo=r(342058),ei=r(955663),ea=r.n(ei),eu=r(440492),ec=r(200770),el=r(199729),es=r.n(el),ed=r(581340),ep=r(527157),ef=r(966622),em=r(943701),eh=r(60074),eg=r(359792),eb=r(52130),ev=function(e,t){if(!(null==e?void 0:e.includes("/checkout")))return!1;var r=Array.isArray(t)?t[0]:t;return!r||"address"===r},ey=function(){var e=(0,eb.L3)().trackJanusEvent;return{trackVoucherManualSubmitError:(0,m.useCallback)(function(t){var r=t.voucherCode,n=t.errorMessage;try{var o=eg.m;e(o.janusEvent({event:o.event({systemMessage:n||"unknown_voucher_error"}),voucher:o.voucher({voucherCode:r||"unknown"})}))}catch(e){(0,eh.Tb)(e,{tags:{event:"CheckoutAddress_VoucherManualSubmitError_SystemAction",component:"useCheckoutAddressVoucherErrorSnowplowEvent"}})}},[e])}},ew=r(947529),eP=function(e,t){return null!=e&&!!e.includes("/checkout")&&"payment"===(Array.isArray(t)?t[0]:t)},ex=function(){var e=(0,eb.L3)().trackJanusEvent;return{trackVoucherManualSubmitError:(0,m.useCallback)(function(t){var r=t.voucherCode,n=t.errorMessage;try{var o=ew.K;e(o.janusEvent({event:o.event({systemMessage:n||"unknown_voucher_error"}),voucher:o.voucher({voucherCode:r||"unknown"})}))}catch(e){(0,eh.Tb)(e,{tags:{event:"CheckoutPayment_VoucherManualSubmitError_SystemAction",component:"useCheckoutPaymentVoucherErrorSnowplowEvent"}})}},[e])}},eO=r(610847),eS=function(){var e=(0,eb.L3)().trackJanusEvent;return{trackChangeVoucherClick:(0,m.useCallback)(function(){try{e(eO.k.janusEvent())}catch(e){(0,eh.Tb)(e,{tags:{event:"CheckoutPayment_Change_Voucher_Button_Click",component:"useCheckoutPaymentChangeVoucherSnowplowEvent"}})}},[e])}},ek=r(614448),eC=function(){var e=(0,eb.L3)().trackJanusEvent;return{trackVoucherManualSubmitError:(0,m.useCallback)(function(t){var r=t.voucherCode,n=t.errorMessage;try{var o=ek.f;e(o.janusEvent({event:o.event({systemMessage:n||"unknown_voucher_error"}),voucher:o.voucher({voucherCode:r||"unknown"})}))}catch(e){(0,eh.Tb)(e,{tags:{event:"PlanSelection_VoucherManualSubmitError_SystemAction",component:"usePlanSelectionVoucherErrorSnowplowEvent"}})}},[e])}},eD=r(779292),ej=function(e,t){return!!((null==e?void 0:e.includes("/reactivate"))||(null==t?void 0:t.includes("/reactivate")))},eZ=function(){var e=(0,eb.L3)().trackJanusEvent,t=(0,ed.t)(),r=t.pathname,n=t.asPath;return{trackVoucherManualSubmitSuccess:(0,m.useCallback)(function(t){var o=t.voucherCode,i=t.systemMessage;if(ej(r,n))try{e(eD.n.janusEvent({event:eD.n.event({systemMessage:void 0===i?"Voucher submitted successfully":i}),voucher:eD.n.voucher({voucherCode:o})}))}catch(e){(0,eh.Tb)(e,{tags:{event:"Reactivation_VoucherManualSubmitSuccess_SystemAction",component:"useReactivationVoucherManualSubmitSuccessSnowplowEvent"}})}},[n,r,e])}};function e_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eA=function(){var e=(0,ec.Z)(),t=(0,ep.Z)(),r=(0,P.Z)().push,n=eZ().trackVoucherManualSubmitSuccess,o=(0,ed.t)(),i=(0,ef.py)({runUsingStatsig:!0}).track,a=(0,em.R)({runUsingStatsig:!0}),u=a.id,c=a.attributes,l=ey().trackVoucherManualSubmitError,s=ex().trackVoucherManualSubmitError,d=eC().trackVoucherManualSubmitError,p=eS().trackChangeVoucherClick,f=(0,m.useCallback)(function(){r({event:"gaEventTrigger",event_name:"Navigation_Scroll",position:"".concat(null==e?void 0:e.toUpperCase(),"-PaymentPage-PriceInfoField"),event_category:"funnel",event_action:"clickPriceDrawer",gaEventLabel:"".concat(null==e?void 0:e.toUpperCase(),"-PaymentPage-PriceInfoField"),screen:null==o?void 0:o.asPath}),i({eventName:"CheckoutPayment_ClickOrderSummaryDrawer",experimentationUserId:u||"",experimentationUserAttributes:c,eventTags:{brand:t,country:e,tribe:"Conversions",EventCategory:"funnel",EventAction:"clickPriceDrawer",EventLabel:"".concat(null==e?void 0:e.toUpperCase(),"-PaymentPage-PriceInfoField"),screen:null==o?void 0:o.asPath,position:"".concat(null==e?void 0:e.toUpperCase(),"-PaymentPage-PriceInfoField")}})},[t,e,r,o,i,c,u]),h=(0,m.useCallback)(function(e){var n=e.totalPrice,a=e.totalPriceWithDiscount,l=e.totalBoxPrice,s=e.totalBoxPriceWithDiscount,d=e.totalShippingPrice,p=e.totalShippingPriceWithDiscount,f=e.voucher,m=e.pricePerServing,h=e.discountedPricePerServing,g=e.sku;i({eventName:"user_saw_price",experimentationUserId:u||"",experimentationUserAttributes:c,eventTags:{brand:t,totalPrice:n,totalPriceWithDiscount:a,totalBoxPrice:l,totalBoxPriceWithDiscount:s,totalShippingPrice:d,totalShippingPriceWithDiscount:p,pricePerServing:m,discountedPricePerServing:h,voucher:f,widget:"order-summary-drawer-feature",page:o.asPath,pagePath:location.href,sku:g}}),r({event:"gaEventTrigger",event_name:"user_saw_price",totalPrice:"".concat(n),totalPriceWithDiscount:"".concat(a.toFixed(2)),totalBoxPrice:"".concat(l),totalBoxPriceWithDiscount:"".concat(s.toFixed(2)),totalShippingPrice:"".concat(d),totalShippingPriceWithDiscount:"".concat(p),pricePerServing:"".concat(m),discountedPricePerServing:"".concat(h),voucher:f,widget:"order-summary-drawer-feature",pagePath:location.href,sku:g,zipCode:y.ZP.getItem("encryptedZipcode")||"",tribe:"customer-benefits",squad:"pricing-experience"})},[i,u,c,o,r,t]),g=(0,m.useCallback)(function(e){var t,n=e.totalPrice,i=e.totalPriceWithDiscount,a=e.shippingFee,u=e.price,c=e.priceWithDiscount,l=e.pricePerServing,s=e.discountPricePerServing,d=e.shippingDiscount,p=e.sku,f=e.couponCode,m=e.zipCode,h=e.currencyCode,g=e.requestId,b=e.productPriceId,v=(null==o?void 0:null===(t=o.asPath)||void 0===t?void 0:t.includes("/reactivate"))?{journey:"reactivation",widget:"reviewSummary"}:{journey:"activation",widget:"orderSummaryPayment"},w=v.journey;r(e_({event_name:"Widget_UserSawPrice",widget:v.widget,journey:w,product_sku:p,currency:h,serving_price:l,serving_price_with_discount:s,box_price:u,box_price_with_discount:c,shipping_price:a,shipping_discount:d,total_price:n,total_price_with_discount:i,voucher:f,zipCode:m||y.ZP.getItem("encryptedZipcode")||""},g?{request_id:g}:{},b?{product_price_id:b}:{}))},[r,o]),b=(0,m.useCallback)(function(e){var i,a,u,c=e.voucher,l=y.ZP.getItem("StoredCouponCode")||null;if(c!==l){var s={gaEventLabel:c,screen:(null==o?void 0:null===(i=o.query)||void 0===i?void 0:i.step)||(null==o?void 0:o.asPath),brand:t,tribe:"Conversions",gaEventCategory:"coupons",voucherCode:c};l?(r(e_({event:"gaEventTrigger",event_name:"Checkout_ChangeExistingVoucher",gaEventAction:"payment coupon change success"},s)),eP(null==o?void 0:o.pathname,null==o?void 0:null===(a=o.query)||void 0===a?void 0:a.step)&&p()):(r(e_({event:"gaEventTrigger",event_name:"Voucher_ManualSubmitSuccess",gaEventAction:"".concat((null==o?void 0:null===(u=o.query)||void 0===u?void 0:u.step)||(null==o?void 0:o.asPath)," coupon add success")},s)),ej(null==o?void 0:o.pathname,null==o?void 0:o.asPath)&&n({voucherCode:c}))}},[r,o,t,p,n]),v=(0,m.useCallback)(function(e){var n,i,a,u,c,p=e.voucher,f=e.errorMsg;r({event:"gaEventTrigger",event_name:"Voucher_ManualSubmitError",brand:t,voucherCode:p,tribe:"Conversions",gaEventCategory:"coupons",gaEventAction:"".concat((null==o?void 0:null===(i=o.query)||void 0===i?void 0:i.step)||(null==o?void 0:o.asPath)," coupon not val
1id - ").concat(f),gaEventLabel:p,screen:(null==o?void 0:null===(a=o.query)||void 0===a?void 0:a.step)||o.asPath}),ev(null==o?void 0:o.pathname,null==o?void 0:null===(u=o.query)||void 0===u?void 0:u.step)&&l({voucherCode:p,errorMessage:f}),eP(null==o?void 0:o.pathname,null==o?void 0:null===(c=o.query)||void 0===c?void 0:c.step)&&s({voucherCode:p,errorMessage:f}),(n=null==o?void 0:o.pathname)&&n.startsWith("/plans")&&d({voucherCode:p,errorMessage:f})},[r,o,t,l,s,d]),w=(0,m.useCallback)(function(e){var n,a,l=e?"close":"open",s={event:"gaEventTrigger",brand:t,tribe:"Conversions",screen:null==o?void 0:o.asPath,gaEventCategory:"unifiedCheckoutSection",event_name:"Checkout_UnifiedFormSection",gaEventAction:l,gaEventLabel:"promo code",action:l,section_name:"promo code"};r(s),i({eventName:"Checkout_UnifiedFormSection",experimentationUserId:u||"",experimentationUserAttributes:c,eventTags:(n=e_({},s),a=a={brand:t,tribe:"Conversions",screen:null==o?void 0:o.asPath,EventCategory:"unifiedCheckoutSection",EventAction:l,EventLabel:"promo code",action:l,section_name:"promo code"},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(a)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))}),n)})},[c,u,r,i,t,null==o?void 0:o.asPath]),x=(0,m.useCallback)(function(e){var n,i="".concat((null==o?void 0:null===(n=o.query)||void 0===n?void 0:n.step)||(null==o?void 0:o.asPath)," coupon submit");r({voucher:e,brand:t,gaEventAction:i,event:"gaEventTrigger",event_name:"Voucher_ManualSubmit",gaEventCategory:"coupons",gaEventLabel:e,action_type:i})},[r,o,t]),O=(0,m.useCallback)(function(e){var n,a="Voucher_ManualSubmitAttempt",l="".concat((null==o?void 0:null===(n=o.query)||void 0===n?void 0:n.step)||(null==o?void 0:o.asPath)," coupon attempt");r({voucher:e,brand:t,event:"gaEventTrigger",event_name:a,gaEventCategory:"coupons",gaEventLabel:"",action_type:l}),i({eventName:a,experimentationUserId:u||"",experimentationUserAttributes:c,eventTags:{brand:t,tribe:"Conversions",screen:null==o?void 0:o.asPath,EventAction:l,EventLabel:""}})},[r,o,t,i,c,u]),S=(0,m.useCallback)(function(){r({event:"gaEventTrigger",gaEventCategory:"navigation",event_name:"Navigation_Scroll",position:"promo-code-field",gaEventAction:"scroll",gaEventLabel:"promo-code-field"}),u&&i({experimentationUserId:u,experimentationUserAttributes:c,eventName:"Navigation_Scroll",eventTags:{EventCategory:"navigation",EventAction:"scroll",EventLabel:"promo-code-field",position:"promo-code-field"}})},[r,i,u,c]);return(0,m.useMemo)(function(){return{trackNavigation:f,trackUserSawPrice:h,trackWidgetUserSawPrice:g,trackSuccessVoucherValidation:b,trackFailedVoucherValidation:v,trackPromoCodeDrawerState:w,trackSubmitVoucher:x,trackSubmitVoucherAttempt:O,trackPromoCodeFieldInView:S}},[f,h,g,v,b,w,x,O,S])};function eE(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function eI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eT=function(e){var t,r,n=e.couponCode,o=e.productSku,i=e.subscriptionId,a=e.customerId,u=e.location,c=e.customerUuid,l=e.customerPlanId,s=(0,ec.Z)(),d=function(e){if(Array.isArray(e))return e}(t=(0,m.useState)({couponCode:n,status:"idle"}))||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return eE(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);
1if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eE(e,2)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=d[0],f=d[1],h=eA(),g=h.trackSuccessVoucherValidation,b=h.trackFailedVoucherValidation,v=(r="fetch"===p.status,"reactivation"===u?r&&!!p.couponCode&&!!o&&!!i&&!!a&&!!s:r),y=(0,eu.W)(eI({country:s,code:p.couponCode,products:[o],customer_id:a||0,subscription_id:Number(i)||0},c&&{customerUuid:c},l&&{customerPlanId:l}),{enabled:v,suspense:!1,onError:function(e){return b({voucher:p.couponCode,errorMsg:"".concat(es()(e,"err.msg")||"Error applying promo code")})}}).status,w=(0,m.useCallback)(function(e){e&&f({status:"fetch",couponCode:e})},[]);return(0,m.useEffect)(function(){n&&f({status:"fetch",couponCode:n})},[o,n]),(0,m.useEffect)(function(){("success"==y||"error"==y)&&"fetch"===p.status&&("success"==y&&g({voucher:p.couponCode}),f(function(e){var t,r;return t=eI({},e),r=r={status:"ready"},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t}))},[y,p,g]),(0,m.useMemo)(function(){return{isVoucherValidated:"ready"===p.status&&"success"===y,hasError:"ready"===p.status&&"error"===y,isValidationReady:"ready"===p.status,setVoucherToValidate:w}},[y,p,w])},eF=r(242200),eB=function(e){var t=e.isVisible,r=e.isPromoCodeValid,n=e.onClick;return t?r?(0,f.tZ)(w.xu,{as:"span","data-test-id":"order-summary-drawer-feature-validation-icon",role:"img","aria-label":"Valid promo code",cursor:"default",children:(0,f.tZ)(w.JO,{icon:(0,f.tZ)(eF.default,{"data-test-id":"order-summary-drawer-feature-checkmark-icon",color:"shared-alias.positive.foreground.default"})})}):(0,f.tZ)(w.xu,{as:"button","data-test-id":"order-summary-drawer-feature-validation-icon",cursor:"pointer",onClick:n,"aria-label":"Remove promo code",borderWidth:0,backgroundColor:"transparent",p:"zero",children:(0,f.tZ)(w.JO,{icon:(0,f.tZ)(eo.default,{"data-test-id":"order-summary-drawer-feature-clear-form-input-icon",color:"alias.interactive.foreground.default"})})}):null};function eV(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eM=function(e){var t,r,n=(null==e?void 0:null===(r=e.discount_settings)||void 0===r?void 0:null===(t=r.discount_rule)||void 0===t?void 0:t.box_rule)||{};return Object.keys(n).map(function(e){return eV({boxKey:e},n[e])})},eW=function(e,t,r){var n=e;return r&&(null==t?void 0:t.discount_type)==="percent"&&(n=n/100*r),n},eU=function(e,t,r){var n=eM(e).map(function(e){var t,n,o;return(null==e?void 0:e.discount_sku)?(n=eV({},e),o=o={discount_value:(null===(t=e.discount_sku[r])||void 0===t?void 0:t.discount_value)||e.discount_value},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(o)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}),n):e}),o=n.reduce(function(r,n){return r+eW((null==n?void 0:n.discount_value)||0,e,t)},0),i=n.find(function(e){return"1"===e.boxKey})||n[0];return o-eW((null==i?void 0:i.discount_value)||0,e,t)},eX=function(e){var t,r=e.price,n=e.couponCode,o=e.isCouponCodeValid,i=e.hasError,a=e.productSku,u=e.shouldDisplayHintWithoutDiscountDetails,c=(0,ec.Z)(),l=(0,S.Z)(),s=(0,O.ZP)(j).translateRaw,d=(0,v.D)().voucherHintWithDiscountDetails,p=(0,U.m)({voucherCode:n,productSkus:[a]},{suspense:!1,enabled:!!a&&o}).data,h=function(e){var t=e.price,r=e.country,n=e.locale,o=e.sku,i=e.voucherData;if(!i)return null;var a=(null==i?void 0:i.repetition_limit)?(null==i?void 0:i.repetition_from_first)?1:0:eM(i).filter(function(e){return e&&(null==e?void 0:e.discount_value)}).length||(null==i?void 0:i.limit_per_subscription)||0,u=eU(i,t,o);if(!u||!a)return null;var c=u?(0,C.xG)(u,{country:r,locale:n,decimals:2}):null;return{boxCount:a-1,discountAmount:u,formattedAmount:c}}({price:r,country:c,locale:l,sku:a,voucherData:(0,er.D)({code:n},{suspense:!1,enabled:o&&d}).data}),g=(0,m.useMemo)(function(){return d&&h&&!u?s("features.checkout-drawer-order-summary.remaining-discount-info",{remainingDiscountAmount:h.formattedAmount,remainingBoxesCount:h.boxCount}):s("features.checkout-drawer-order-summary.valid-coupon-message")},[s,d,h,u]),b=(0,R.Z)(),y=null==p?void 0:null===(t=p.presets)||void 0===t?void 0:t[a],P=b?null==y?void 0:y.reactivation_summary_message:g,x=(0,m.useMemo)(function(){return s("features.checkout-drawer-order-summary.failure-coupon-message")},[s]);return(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-voucher-hint",minHeight:"20px",children:(o||i)&&(0,f.tZ)(w.xv,{"data-test-id":o?"order-summary-drawer-feature-voucher-success-hint":"order-summary-drawer-feature-voucher-failure-hint",type:"body-xs-regular",color:o?"success.600":"error.600",children:o?P:x})})},eR=r(877520),eL=r(90295);function eN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eG(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function eH(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return eG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eG(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var eq=function(e){var t,r,n,o,i,a,u,c,l,s,d,p,h=e.couponCode,g=e.numberOfServings,b=e.grandTotal,y=e.price,P=e.shippingAmount,x=e.productSku,S=e.focusOnMount,k=void 0!==S&&S,C=e.onVoucherSubmit,D=e.subscriptionId,Z=e.customerId,_=e.skipVoucherValidationOnSubmit,A=e.location,E=e.onValidationStateChange,I=e.shouldDisplayHintWithoutDiscountDetails,F=e.customerUuid,B=e.customerPlanId,V=eA(),M=V.trackSubmitVoucherAttempt,W=V.trackSubmitVoucher,U=(0,O.ZP)(j),X=U.translateRaw,R=U.translate,L=(0,m.useRef)(null),N=eH((0,m.useState)(h.toUpperCase()),2),G=N[0],H=N[1];(0,m.useEffect)(function(){if(k){var e;null===(e=L.current)||void 0===e||e.focus()}},[k]);var q=eH((0,m.useState)(!1),2),J=q[0],z=q[1],$=eT({couponCode:h,productSku:x,subscriptionId:D,customerId:Z,location:A,customerUuid:F,customerPlanId:B}),Y=$.isVoucherValidated,K=$.hasError,Q=$.isValidationReady,ee=$.setVoucherToValidate,et=(r=(t={productSku:x,numberOfServings:g,grandTotal:b,shippingAmount:P}).productSku,n=t.numberOfServings,o=t.grandTotal,i=t.shippingAmount,a=(0,v.D)().isVoucherNotificationEnabled,u=(0,O.ZP)("senf-notification").translateRaw,c=(0,m.useMemo)(function(){return{productDetails:{servings:n,sku:r},pricingDetails:{subTotal:o,shippingAmount:i}}},[n,r,o,i]),l=(0,m.useCallback)(function(e){return eR.ZP.create("","pricePresentationNotification",{type:eR.k$.success,meta:eN({isPricePresentationNotification:!0,code:e},c)})},[c]),s=(0,m.useCallback)(function(e){var t=u("senf-notification.validation-fallback");return eR.ZP.create(t,"voucherErrorNotification",{type:eR.k$.error,overrideId:"voucher-error",meta:eN({code:e},c)})},[c,u]),d=function(e){var t;return!!(null===(t=e.meta)||void 0===t?void 0:t.isPricePresentationNotification)||"price-presentation-error"===e.id||"voucher-error"===e.id||"error-checkout-submit-rejected"===e.id},p=(0,m.useCallback)(function(e){var t=e.voucher,r=e.isSuccess;if(a){var n=r?l(t):s(t);(0,eL.iX)(d),(0,eL.FV)(n),(0,eL.wN)(n)}},[l,s,a]),(0,m.useMemo)(function(){return{sendNotification:p}},[p])).sendNotification,er=(0,m.useMemo)(function(){return!!h&&h===G&&Y},[h,G,Y]),en=(0,m.useCallback)(function(e){return H((ea()(e.target.value)||"").toUpperCase())},[]),eo=(0,m.useCallback)(function(){var e=ea()(G);if(W(e),!e){z(!1),C&&C(""),null==E||E(!1);return}_?(C&&C(e),null==E||E(er)):(ee(e),z(!0))},[G,er,E,C,ee,_,W]);return(0,m.useEffect)(function(){J&&Q&&Y&&(et({voucher:G,isSuccess:!0}),C&&C(G),null==E||E(!0),z(!1))},[J,et,Q,Y,G,C,E]),(0,m.useEffect)(function(){J&&Q&&K&&(et({voucher:"",isSuccess:!1}),C&&C(G,!1),null==E||E(!1),z(!1))},[K,J,Q,et,E,C,G]),(0,m.useEffect)(function(){H(h.toUpperCase())},[h]),(0,m.useEffect)(function(){ee(h)},[h,ee]),(0,m.useEffect)(function(){Y&&(null==E||E(!0))},[Y,E]),(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-feature-promo-form",display:"flex",flexWrap:"nowrap",children:[(0,f.tZ)(w.xu,{color:"neutral.300",position:"relative",flexGrow:1,children:(0,f.BX)(w.NI,{labelText:X(T),id:"promo-code-input",children:[(0,f.tZ)(w.NI.TextInput,{ref:L,id:"promo-code-input","aria-label":X(T)||"Insert promo code","data-test-id":"order-summary-drawer-feature-voucher-textbox",success:er,error:K,onKeyDown:function(e){var t=e.key,r=ea()(G);"Enter"===t&&r&&(e.preventDefault(),eo())},placeholder:X(T),onChange:en,value:G,validationIcon:(0,f.tZ)(eB,{isVisible:!!G,isPromoCodeValid:er,onClick:function(){return H("")}}),onClick:function(){M(G)}}),(0,f.tZ)(eX,{price:y,couponCode:G,isCouponCodeValid:er,hasError:K,productSku:x,shouldDisplayHintWithoutDiscountDetails:void 0!==I&&I})]})}),(0,f.tZ)(w.xu,{minWidth:"fit-content",maxWidth:"100px",ml:"xs",children:(0,f.tZ)(w.zx.Secondary,{"data-test-id":"order-summary-drawer-feature-apply-voucher-button",type:"submit",onClick:eo,disabled:J||!G.trim(),children:R("features.checkout-drawer-order-summary.promo-code.cta")})})]})},eJ=function(e){var t=e.title,r=e.subtitle,n=e.icon;return(0,f.BX)(w.xu,{backgroundColor:"global.cream.200",borderRadius:"border-radius-md",p:"global.sm-2",display:"flex",alignItems:r?"flex-start":"center",justifyContent:"space-between",gap:"global.sm-1","data-test-id":"promotions-discount-card",children:[(0,f.BX)(w.xu,{gap:"global.xxs",my:"auto",children:[(0,f.tZ)(w.xv,{as:"h3",mb:"global.xs",children:t}),r&&(0,f.tZ)(w.xv,{type:"body-sm-regular",children:r})]}),(0,f.tZ)(w.xu,{as:"img",src:n,alt:"","aria-hidden":"true",width:"72px",height:"72px",flexShrink:0,"data-test-id":"discount-card-icon"})]})},ez=function(e){var t=e.savingsText,r=e.shippingDetails,n=e.freeAddonText,o=e.ppsFreeAddonImage,i=e.ppsFreeAddonSubtitle,a=e.multiBoxDiscountSummary,u=(0,O.ZP)(j).translateRaw;return t||r||n?(0,f.BX)(w.xu,{display:"flex",flexDirection:"column",gap:"global.sm-1","data-test-id":"promo-code-discount-cards",children:[(0,f.tZ)(w.xv,{as:"h3",children:u(V)}),(0,f.BX)(w.xu,{display:"flex",flexDirection:"column",gap:"global.xs",children:[t&&(0,f.tZ)(eJ,{title:t,subtitle:ee(null!=a?a:""),icon:B.DISCOUNT}),r&&(0,f.tZ)(eJ,{title:r.text,subtitle:u("features.checkout-drawer-order-summary.promo-drawer-shipping-text"),icon:B.FREE_SHIPPING}),n&&(0,f.tZ)(eJ,{title:ee(n),subtitle:ee(i),icon:null!=o?o:B.DELIVERY_BOX})]})]}):null},e$=function(){var e=(0,O.ZP)(j).translate;return(0,f.BX)(w.xu,{py:"global.lg-1",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",gap:"global.xs","data-test-id":"promo-code-empty-state",children:[(0,f.tZ)(w.xu,{as:"img",src:"https://cdn.hellofresh.com/funnel/order-summary/opened-box.png",alt:"","aria-hidden":"true",width:"96px",height:"96px","data-test-id":"promo-code-empty-state-image"}),(0,f.tZ)(w.xv,{type:"body-md-bold",children:e("features.promo-code-form.no-promo-code-text")}),(0,f.tZ)(w.xv,{type:"body-sm-regular",children:e("features.promo-code-form.no-promo-code-subtext")})]})},eY=r(407792),eK=function(){var e=(0,ep.Z)(),t=(0,P.Z)().push,r=(0,ed.t)().asPath,n=null==r?void 0:r.split("?")[0],o=(0,ef.py)({runUsingStatsig:!0}),i=o.track,a=o.isReady,u=(0,eY.O)(),c=u.id,l=u.attributes,s=(0,em.R)({runUsingStatsig:!0}).id;return{trackStatsigEvents:(0,m.useCallback)(function(t,r){var o,a;i({experimentationUserId:null!=s?s:c,experimentationUserAttributes:l,eventName:t,eventTags:(o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},r),a=a={brand:e,screen:n,tribe:"Conversions Journey"},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(a)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(a)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(a,e))}),o)})},[i,c,l,e,n,s]),isReady:a,trackOrderReviewPromotionsEditClick:(0,m.useCallback)(function(r){var o=ee(r);t({event:"gaEventTrigger",event_name:"Checkout_OrderReviewPromotionsEditClick",brand:e,tribe:"Conversions Journey",screen:n,gaEventCategory:"funnel",gaEventAction:"OrderReviewPromotionsEditClick",gaEventLabel:o,benefits_shown:o}),i({eventName:"Checkout_OrderReviewPromotionsEditClick",experimentationUserId:null!=s?s:c,experimentationUserAttributes:l,eventTags:{brand:e,tribe:"Conversions Journey",EventCategory:"funnel",EventAction:"OrderReviewPromotionsEditClick",EventLabel:o}})},[e,l,c,t,n,i,s]),trackPromotionDetailsDrawerDisplay:(0,m.useCallback)(function(r){var o=ee(r);t({event:"gaEventTrigger",event_name:"Checkout_PromotionDetailsDrawerDisplay",brand:e,tribe:"Conversions Journey",screen:n,gaEventCategory:"funnel",gaEventAction:"PromotionDetailsDrawerDisplay",gaEventLabel:o,benefits_shown:o}),i({eventName:"Checkout_PromotionDetailsDrawerDisplay",experimentationUserId:null!=s?s:c,experimentationUserAttributes:l,eventTags:{brand:e,tribe:"Conversions Journey",EventCategory:"funnel",EventAction:"PromotionDetailsDrawerDisplay",EventLabel:o}})},[e,l,c,t,n,i,s]),trackPromotionDetailsDrawerClose:(0,m.useCallback)(function(r){var o=ee(r);t({event:"gaEventTrigger",event_name:"Checkout_PromotionDetailsDrawerClose",brand:e,tribe:"Conversions Journey",screen:n,gaEventCategory:"funnel",gaEventAction:"PromotionDetailsDrawerClose",gaEventLabel:o,benefits_shown:o}),i({eventName:"Checkout_PromotionDetailsDrawerClose",experimentationUserId:null!=s?s:c,experimentationUserAttributes:l,eventTags:{brand:e,tribe:"Conversions Journey",EventCategory:"funnel",EventAction:"PromotionDetailsDrawerClose",EventLabel:o}})},[e,l,c,t,n,i,s])}};function eQ(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var e0=function(e){var t,r,n,o=e.benefitsShown,i=e.isOpen,a=e.onClose,u=e.promoCodeFormProps,c=e.savingsText,l=e.shippingDetails,s=e.ppsFreeAddonImage,d=e.ppsFreeAddonSubtitle,p=e.ppsFreeAddonTitleCopy,h=e.multiBoxDiscountSummary,g=(0,O.ZP)(j).translate,b=eK().trackPromotionDetailsDrawerDisplay,v=(0,m.useRef)(null),y=function(e){if(Array.isArray(e))return e}(t=(0,m.useState)(!1))||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return eQ(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eQ(e,2)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),P=y[0],x=y[1],S=(0,m.useRef)(!1),k=(0,m.useCallback)(function(e){x(e)},[]),C=c||l;return(0,m.useEffect)(function(){i&&!S.current?(b(o),S.current=!0):i||(S.current=!1)},[i,b]),(0,f.tZ)(w.dy.Container,{placement:"bottom",isOpen:i,onDismiss:a,onClose:a,isModal:!0,returnFocusRef:v,"data-test-id":"promo-code-applied-drawer",width:"100%",hideCloseButton:!0,paddingX:"global.xs",paddingY:"global.md-1",children:(0,f.BX)(w.xu,{display:"flex",flexDirection:"column",height:"100%",children:[(0,f.BX)(w.xu,{display:"flex",alignItems:"center",pb:"global.md-1",position:"relative",children:[(0,f.tZ)(w.xu,{position:"absolute",left:"50%",transform:"translateX(-50%)",children:(0,f.tZ)(w.xv,{type:"body-lg-bold",children:g("features.checkout-drawer-order-summary.promo-drawer-title")})}),(0,f.tZ)(w.xu,{as:"button",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",backgroundColor:"transparent",borderWidth:"0px",cursor:"pointer","aria-label":"Close promotions drawer and return to order summary",onClick:a,"data-test-id":"promotions-drawer-close-button",ml:"auto",children:(0,f.tZ)(eo.default,{})})]}),(0,f.BX)(w.xu,{p:"global.sm-2",display:"flex",flexDirection:"column",gap:"global.md-1",flex:"1","aria-live":"polite",children:[(0,f.tZ)(eq,(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},u),n=n={onValidationStateChange:k,shouldDisplayHintWithoutDiscountDetails:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r)),P&&C?(0,f.tZ)(ez,{savingsText:c,shippingDetails:l,multiBoxDiscountSummary:h,freeAddonText:p,ppsFreeAddonImage:s,ppsFreeAddonSubtitle:d}):(0,f.tZ)(e$,{})]})]})})};function e1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var e2=function(e){var t,r=e.couponCode,n=e.productSku,o=e.price,i=e.onVoucherSubmit,a=e.savingsText,u=e.shippingDetails,c=e.ppsFreeAddonImage,l=e.ppsFreeAddonTitleCopy,s=e.ppsFreeAddonSubtitle,d=e.multiBoxDiscountSummary,p=(0,O.ZP)(j).translate,h=eK(),g=h.trackOrderReviewPromotionsEditClick,b=h.trackPromotionDetailsDrawerClose,v=function(e){if(Array.isArray(e))return e}(t=(0,m.useState)(!1))||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return e1(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e1(e,2)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),y=v[0],P=v[1],x="".concat(null!=d?d:a," | ").concat(null==u?void 0:u.text," | ").concat(null!=l?l:""," ").concat(null!=s?s:"").trim(),S=(0,m.useCallback)(function(){P(!0),g(x)},[g,x]),k=(0,m.useCallback)(function(){P(!1),b(x)},[b,x]),C=(0,m.useCallback)(function(e){null==i||i(e)},[i]);return(0,f.BX)(f.HY,{children:[(0,f.tZ)(w.xu,{as:"button","data-test-id":"order-review-section-promotions-action",backgroundColor:"alias.elevation.base",borderWidth:"0px",cursor:"pointer",display:"flex",onClick:S,"aria-label":"Add, view, or update promotions",pt:"global.sm-1",children:(0,f.BX)(w.xu,{display:"flex",alignItems:"center",children:[(0,f.tZ)(w.xu,{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",pr:"global.xs",pt:"global.xxs",children:(0,f.tZ)(w.JO,{icon:(0,f.tZ)(en.default,{}),"aria-hidden":"true"})}),(0,f.tZ)(w.xu,{children:(0,f.tZ)(w.xv,{type:"body-sm-bold",textAlign:"left",children:p("features.checkout-drawer-order-summary.order-review-add-update-promo-text")})})]})}),(0,f.tZ)(e0,{benefitsShown:x,isOpen:y,onClose:k,promoCodeFormProps:{couponCode:r,productSku:n,numberOfServings:4,grandTotal:o,price:o,shippingAmount:0,focusOnMount:!0,onVoucherSubmit:C},savingsText:a,shippingDetails:u,ppsFreeAddonImage:c,ppsFreeAddonTitleCopy:l,ppsFreeAddonSubtitle:s,multiBoxDiscountSummary:d})]})},e3=function(e){var t=e.hasDiscount,r=e.price,n=e.paidPrice,o=e.isFetchingPrices,i=e.hasFreeAddonOffer,a=e.ppsFreeAddonImage,u=e.ppsFreeAddonTitleCopy,c=e.ppsFreeAddonSubtitle,l=e.savingsText,s=e.shippingDetails,d=(0,O.ZP)(j).translate,p=D(t?r-n:0);return(0,f.BX)(w.xu,{"data-test-id":"order-review-section-promotions",pt:"global.sm-1",children:[(0,f.tZ)(w.xv,{"data-test-id":"order-review-section-promotions-title",as:"p",type:"body-xs-bold",color:"alias.elevation.foreground.base-alt",textAlign:"left",mb:"global.sm-1",textTransform:"uppercase",children:d(V)}),(0,f.BX)(w.xu,{display:"flex",flexDirection:"column",gap:"global.sm-1",children:[(0,f.BX)(w.xu,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,f.BX)(w.xu,{display:"flex",alignItems:"center",gap:"global.sm-1",children:[(0,f.tZ)(w.xu,{as:"img",src:B.DISCOUNT,alt:"","aria-hidden":"true",width:"32px",height:"32px"}),(0,f.tZ)(w.xv,{type:"body-sm-regular",color:"shared-alias.neutral.foreground.default",children:l})]}),(0,f.BX)(w.xv,{type:"body-md-bold",color:"shared-alias.negative.foreground.default",whiteSpace:"nowrap",children:["-",Q(p,o)]})]}),!!s&&(0,f.BX)(w.xu,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,f.BX)(w.xu,{display:"flex",alignItems:"center",gap:"global.sm-1",children:[(0,f.tZ)(w.xu,{as:"img",src:B.FREE_SHIPPING,alt:"","aria-hidden":"true",width:"32px",height:"32px"}),(0,f.tZ)(w.xv,{type:"body-sm-regular",children:(null==s?void 0:s.text)||"Free shipping"})]}),(0,f.tZ)(w.xv,{type:"body-md-bold",color:"shared-alias.negative.foreground.default",whiteSpace:"nowrap",children:d("features.checkout-drawer-order-summary.shipping.free.text-uppercase")})]}),i&&(0,f.BX)(w.xu,{display:"flex",alignItems:"flex-start",justifyContent:"space-between",children:[(0,f.BX)(w.xu,{display:"flex",alignItems:"center",gap:"global.sm-1",children:[a&&(0,f.tZ)(w.xu,{as:"img",src:a,alt:"","aria-hidden":"true",width:"32px",height:"32px"}),(0,f.BX)(w.xu,{display:"flex",flexDirection:"column",children:[(0,f.tZ)(w.xv,{type:"body-sm-regular",children:ee(u)}),c&&(0,f.tZ)(w.xv,{type:"body-xs-regular",children:c})]})]}),(0,f.tZ)(w.xv,{type:"body-md-bold",color:"shared-alias.negative.foreground.default",whiteSpace:"nowrap",children:d("features.checkout-drawer-order-summary.freeAddOn-free")})]})]})]})},e5=function(e){var t=e.productSpecs,r=e.finalPriceFormatted,n=e.isFetchingPrices,o=(0,O.ZP)(j).translate,i=(0,O.ZP)("funnel.cart").translateRaw,a=o(Z,{meals:t.meals,size:t.people});return(0,f.BX)(w.xu,{"data-test-id":"order-review-section-your-plan",pt:"global.sm-1",children:[(0,f.tZ)(w.xv,{"data-test-id":"order-review-section-your-plan-title",as:"p",type:"body-xs-bold",color:"alias.elevation.foreground.base-alt",textAlign:"left",mb:"global.sm-1",textTransform:"uppercase",children:i("funnel.cart.header.title")}),(0,f.BX)(w.xu,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,f.BX)(w.xu,{display:"flex",alignItems:"center",gap:"global.sm-1",children:[(0,f.tZ)(w.xu,{as:"img",src:B.DELIVERY_BOX,alt:"","aria-hidden":"true",width:"32px",height:"32px"}),(0,f.tZ)(w.xv,{"data-test-id":"order-review-section-your-plan-product-specs",type:"body-sm-regular",children:a})]}),(0,f.tZ)(w.xv,{"data-test-id":"order-review-section-your-plan-price",type:"body-md-bold",whiteSpace:"nowrap",children:Q(r,n)})]})]})},e8=function(e){var t=e.hasDiscount,r=e.isFetchingPrices,n=e.finalPriceFormatted,o=e.grandTotalFormatted,i=(0,O.ZP)(j).translate;return(0,f.BX)(w.xu,{"data-test-id":"order-review-section-first-box-total",display:"flex",alignItems:"center",justifyContent:"space-between",mt:"global.sm-2",children:[(0,f.tZ)(w.xv,{type:"body-md-bold",children:i(E)}),(0,f.BX)(w.xu,{display:"flex",alignItems:"center",gap:"global.xs",children:[t&&(0,f.tZ)(w.xv,{type:"body-md-regular",color:"global.gray.600",textDecorationLine:"line-through",children:Q(n,r)}),(0,f.tZ)(w.xv,{type:"body-md-bold",color:t?"shared-alias.negative.foreground.default":"shared-alias.neutral.foreground.default","data-test-id":"order-review-section-final-total",children:Q(o,r)})]})]})};function e4(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}(n=c||(c={})).PERCENT="percent",n.FIXED="fixed";var e7=function(e,t,r,n){var o=0,i=0,a=0,u=[];return Object.entries(e).forEach(function(e){var c=function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return e4(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);
1if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e4(e,2)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=c[0],s=c[1],d="percent"===t?s.discount_value/100*r/100:s.discount_value/100;o+=Math.round(d),"1"===l&&(a="percent"===t?s.discount_value/100:d),("shipping"===s.applicable_to||"both"===s.applicable_to)&&(i+="both"===s.applicable_to?((null==n?void 0:n.shipping_amount)||0)/100:d,u.push(l))}),{totalSavings:o,shippingDiscount:i,firstBoxDiscount:a,shippingBoxes:u}},e6=function(e,t,r,n){if(0===e||0===t)return"";var o=e%1==0?r.replace(/\.00(?=\D|$)/,""):r;return t>1?n("features.checkout-drawer-order-summary.order-review-promo-savings",{discountPrice:o,noOfboxes:t}):n("features.checkout-drawer-order-summary.promo-drawer-first-box-savings",{firstBoxDiscount:o})},e9=function(e){var t,r,n=(null==e?void 0:null===(r=e.discount_settings)||void 0===r?void 0:null===(t=r.discount_rule)||void 0===t?void 0:t.box_rule)||{};return Object.keys(n).map(function(t){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({boxKey:t,discountType:(null==e?void 0:e.discount_type)||""},n[t])})},te=function(e,t,r){var n=e.discountType,o=e.discount_value;return"percent"===n&&r===c.FIXED?o/100*t/100:"fixed"===n&&r===c.PERCENT?100-100*(t-o/100)/t:"percent"===n&&r===c.PERCENT||"fixed"===n&&r===c.FIXED?o/100:o},tt=r(830644),tr=r.n(tt);(o=l||(l={})).ZERO="zero",o.ONE="one",o.MANY="many";var tn=function(e,t){return tr()(t)?e:0===t?"".concat(e,"[","zero","]"):1===t?"".concat(e,"[","one","]"):"".concat(e,"[","many","]")},to=function(e){var t={};return(e.forEach(function(e){return t[e.applicable_to]=e.applicable_to}),Object.keys(t).length<=0)?"":Object.keys(t).length>1?"both":Object.values(t)[0]},ti=function(e){var t=(null==e?void 0:e.repetition_limit)||0;return t?t+((null==e?void 0:e.repetition_from_first)?1:0):e9(e).filter(function(e){return e&&(null==e?void 0:e.discount_value)}).length||(null==e?void 0:e.limit_per_subscription)||0},ta=function(e,t,r,n){var o=(0,O.ZP)("features.promo-code-form").translateRaw,i=(0,O.ZP)(j).translateRaw,a=(0,k.Z)(),u=(0,S.Z)(),l=(0,m.useMemo)(function(){var t,r,n;return{boxCount:(null==e?void 0:null===(t=e.discount_settings)||void 0===t?void 0:t.box_count)||1,boxRule:(null==e?void 0:null===(n=e.discount_settings)||void 0===n?void 0:null===(r=n.discount_rule)||void 0===r?void 0:r.box_rule)||{},discountType:["percent","fixed"].includes((null==e?void 0:e.discount_type)||"")?null==e?void 0:e.discount_type:void 0}},[e]),s=(0,m.useCallback)(function(e){return(0,C.xG)(100*e,{locale:u,country:a,decimals:2})},[u,a]),d=(0,m.useMemo)(function(){return e7(l.boxRule,l.discountType,t||0,e)},[l.boxRule,l.discountType,t,e]),p=D(d.totalSavings),f=D(d.shippingDiscount),h=D((0,m.useMemo)(function(){return l.discountType===c.PERCENT?d.firstBoxDiscount/100*(t||0):d.firstBoxDiscount},[d.firstBoxDiscount,l.discountType,t])),g=(0,m.useMemo)(function(){var e;return{firstBoxDiscountFormatted:(e=d.firstBoxDiscount,l.discountType,0===e?"":e%1==0?h.replace(/\.00(?=\D|$)/,""):h),savingsText:e6(d.totalSavings,l.boxCount,p,i),shippingDetails:0===d.shippingBoxes.length?null:{text:o("features.promo-code-form.free-shipping"),savings:f}}},[d.firstBoxDiscount,d.totalSavings,d.shippingBoxes,l.discountType,l.boxCount,h,p,i,f,o]),b=(0,m.useMemo)(function(){return function(e){var t,r,n=e.pricePresentationData,o=e.voucherData,i=e.productSku,a=e.boxPrice,u=e.discountType,l=e.translateRaw,s=e.getFormattedPrice,d=es()(n,"presets.".concat(i,".").concat("activation-promo-code-form-next-boxes-discount"),""),p=e9(o);if(d)return d;if(!o||p.length<=1)return"";var f=p.map(function(e){var t,r,n;return(null==e?void 0:e.discount_sku)?(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),n=n={discount_value:(null===(t=e.discount_sku[i])||void 0===t?void 0:t.discount_value)||e.discount_value},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r):e}),m=ti(o)-1,h=f.filter(function(e){return"1"!==e.boxKey}),g=u===c.PERCENT?h.reduce(function(e,t){return e+(t.discount_value||0)/100*a/100},0):h.reduce(function(e,t){return e+te(t,a,u)},0);switch(to(h)){case"shipping":return l(tn("features.promo-code-form.next-boxes-free-shipping",m),{remainingBoxesCount:m});case"products":case"both":return t=s(g),r=Number.isInteger(g)?t.replace(/\.00(?=\D|$)/,""):t,l(tn("features.promo-code-form.next-boxes-discount",m),{remainingDiscountAmount:r,remainingBoxesCount:m});default:return""}}({pricePresentationData:r||{},voucherData:e||{},productSku:n||"",boxPrice:t||0,discountType:l.discountType||c.PERCENT,translateRaw:o||"",getFormattedPrice:s})},[r,e,n,t,l.discountType,o,s]),v=(0,m.useMemo)(function(){return 1!==l.boxCount&&b?"".concat(g.firstBoxDiscountFormatted," off your first box, ").concat(b):""},[l.boxCount,b,g.firstBoxDiscountFormatted]);return(0,m.useMemo)(function(){return{totalSavings:d.totalSavings,totalSavingsFormatted:p,boxCount:l.boxCount,savingsText:g.savingsText,shippingDetails:g.shippingDetails,pricePresentationData:r||{},productSku:n||"",firstBoxDiscountFormatted:g.firstBoxDiscountFormatted,nextBoxesDiscountsMessage:b,multiBoxDiscountSummary:v}},[d.totalSavings,p,l.boxCount,g,r,n,b,v])},tu=function(e){var t,r=e.productSpecs,n=e.paidPrice,o=e.isFetchingPrices,i=e.couponCode,a=e.productSku,u=e.hasDiscount,c=e.price,l=e.onVoucherSubmit,s=e.finalPriceFormatted,d=e.grandTotalFormatted,p=(0,er.D)({code:i||""},{suspense:!1,enabled:!!i}).data,m=(0,U.m)({voucherCode:i||"",productSkus:[a]},{suspense:!1,enabled:!!i}).data,h=null==m?void 0:null===(t=m.presets)||void 0===t?void 0:t[a],g=(null==h?void 0:h.funnel_cart_summary_free_addon_image)||"",b=(null==h?void 0:h.funnel_cart_summary_free_addon_title_copy)||"",v=(null==h?void 0:h.funnel_cart_summary_free_addon_subtitle)||"",y=!!b,P=ta(p,c,m,a),x=P.savingsText,O=P.shippingDetails,S=P.multiBoxDiscountSummary;return(0,f.BX)(w.xu,{as:"section","data-test-id":"order-review-section-container","aria-label":"Order review section",children:[(0,f.tZ)(e5,{productSpecs:r,finalPriceFormatted:s,isFetchingPrices:o}),u&&(0,f.tZ)(e3,{hasDiscount:u,price:c,paidPrice:n,isFetchingPrices:o,hasFreeAddonOffer:y,savingsText:x,shippingDetails:O,ppsFreeAddonImage:g,ppsFreeAddonSubtitle:v,ppsFreeAddonTitleCopy:b}),(0,f.tZ)(e2,{couponCode:i,productSku:a,price:c,onVoucherSubmit:l,savingsText:x,shippingDetails:O,ppsFreeAddonImage:g,ppsFreeAddonTitleCopy:b,ppsFreeAddonSubtitle:v,multiBoxDiscountSummary:S}),(0,f.tZ)(w.iz,{}),(0,f.tZ)(e8,{hasDiscount:u,isFetchingPrices:o,finalPriceFormatted:s,grandTotalFormatted:d})]})},tc=function(e){var t=e.specs,r=e.numberOfServings,n=e.productSku,o=e.couponCode,i=e.pricePerServing,a=e.discountedPricePerServing,u=e.finalPrice,c=e.grandTotal,l=e.subTotal,s=e.paidPrice,d=e.hasDiscount,p=e.isDropdownOpen,h=e.isHFDefaultGlobalFlow,g=e.isFetchingPrices,b=e.isProgramsProduct,v=e.hideHeader,y=void 0!==v&&v,P=e.showNewSummaryUI,S=e.price,k=e.hideFreeAddonOfferDetails,C=e.onVoucherSubmit,A=e.isGiftWithPurchaseEnabled,E=(0,O.ZP)(j),I=E.translate,T=E.translateRaw,B=D(u),V=D(c),M=D(i),W=D(a),U=(0,m.useMemo)(function(){return d&&i>a},[i,a,d]),X=et(t.meals,l,s),R=X.daysPerWeek,L=X.pricePerDay,N=X.discountedPricePerDay,G=d&&0===c?T(F):V,H=T(_,{discountedPrice:G,originalPrice:B}),q=I(h?"features.checkout-drawer-order-summary.price-per-meal":"features.checkout-drawer-order-summary.price-per-serving-v2",{servingsCount:r,price:M}),J=h?T("features.checkout-drawer-order-summary.price-per-meal-with-discount",{servingsCount:r,price:W,originalPrice
1:M}):T("features.checkout-drawer-order-summary.price-per-serving-v2-with-discount",{servingsCount:r,price:"\xa0".concat(W),originalPrice:M}),z=I(h&&!P?"features.checkout-drawer-order-summary.newPlanSelection.recipes-people":Z,{meals:t.meals,size:t.people}),$=b?I("features.checkout-drawer-order-summary.programs.order-summary"):z,Y=b?I("features.checkout-drawer-order-summary.programs.price-per-serving-v2",{daysPerWeek:R,pricePerDay:L}):q,ee=b?T("features.checkout-drawer-order-summary.programs.price-per-serving-v2.discounted",{daysPerWeek:R,discountedPricePerDay:"\xa0".concat(N),originalPricePerDay:L}):J;return(0,f.BX)(f.HY,{children:[P?(0,f.tZ)(tu,{productSpecs:t,paidPrice:s,isFetchingPrices:g,couponCode:o,productSku:n,hasDiscount:d,price:S,finalPriceFormatted:B,grandTotalFormatted:V,onVoucherSubmit:C}):(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-feature-product-details","data-product-sku":n,display:"flex",justifyContent:"space-between",lineHeight:"line-height-md-2",mt:y?"global.none":"global.sm-1",mb:p?"global.none":"global.sm-2",flexWrap:"wrap",children:[!y&&!(A&&p)&&(0,f.tZ)(w.xv,{textAlign:"left",color:"shared-alias.neutral.foreground.default",children:$}),!p&&(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-product-details-closed",display:"flex",flexDirection:"column",alignSelf:"flex-end",fontWeight:"headline",children:(0,f.BX)(w.xu,{children:[!d&&(0,f.tZ)(w.xv,{strong:!0,textAlign:"right",color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-product-details-closed-price",as:"span",color:"shared-alias.neutral.foreground.default",textDecorationLine:"none",children:Q(V,g)})}),d&&g&&(0,f.tZ)(w.xv,{textAlign:"right",color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:Q(B,g)}),d&&!g&&(0,f.tZ)(w.xv,{role:"group","aria-label":H,textAlign:"right",color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:(0,f.BX)(w.xu,{as:"span","aria-hidden":"true",children:[(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-product-details-closed-price",as:"span",textDecorationLine:"line-through",children:B}),(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-product-details-closed-price-with-discount",as:"span",ml:"global.xxs",color:A?"shared-alias.neutral.foreground.default":"shared-alias.negative.foreground.default",fontWeight:"body-bold",children:G})]})})]})})]}),p&&(0,f.BX)(f.HY,{children:[!P&&(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-feature-product-details-open",display:"flex",justifyContent:"space-between",lineHeight:"line-height-md-2",pt:"xs",children:[!b&&U&&(0,f.tZ)(w.xv,{"data-test-id":"order-summary-drawer-feature-product-details-open-price-with-discount",color:"shared-alias.neutral.foreground.default",children:(0,f.tZ)(w.xu,{children:(0,f.tZ)(x.Z,{hasMarkdown:!0,copy:J})})}),b&&U&&(0,f.tZ)(w.xv,{"data-test-id":"order-summary-feature-price-product-details-open-programs-price-with-discount",mt:"global.xxs",color:"shared-alias.neutral.foreground.default",textAlign:"left",children:(0,f.tZ)(x.Z,{hasMarkdown:!0,copy:ee})}),!U&&(0,f.tZ)(w.xv,{"data-test-id":"order-summary-feature-price-product-details-open-price",mt:"global.xxs",color:"shared-alias.neutral.foreground.default",textAlign:"left",children:Y})]}),!b&&!k&&(0,f.tZ)(K,{voucherCode:o,productSku:n,showNewSummaryUI:P})]})]})},tl=function(e){var t=e.label,r=e.price,n=e.rawPrice,o=e.priceWithDiscount,i=e.rawPriceWithDiscount,a=e.isDiscount,u=e.dataTestId,c=e.isFetchingPrices,l=(0,O.ZP)(j),s=l.translate,d=l.translateRaw,p=a&&0===i?s(F):o,m=a&&0===i?d(F):o,h=d(_,{discountedPrice:m,originalPrice:r});return(0,f.BX)(w.xu,{"data-test-id":u,display:"flex",justifyContent:"space-between",alignItems:"center",lineHeight:"line-height-md-1","aria-busy":c,children:[(0,f.tZ)(w.xv,{"data-test-id":"".concat(u,"-price-item-label"),type:"body-md-regular",color:"shared-alias.neutral.foreground.default",children:t}),!a&&(0,f.tZ)(w.xu,{children:(0,f.tZ)(w.xv,{"data-test-id":"".concat(u,"-price-item-value"),strong:!0,color:n<=0?"shared-alias.negative.foreground.default":"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:Q(r,c)})}),a&&c&&(0,f.tZ)(w.xv,{color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:Q(r,c)}),a&&!c&&(0,f.tZ)(w.xv,{role:"group","aria-label":h,color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:(0,f.BX)(w.xu,{as:"span","aria-hidden":"true",children:[(0,f.tZ)(w.xu,{"data-test-id":"".concat(u,"-price-item-value"),as:"span",textDecorationLine:"line-through",children:r}),(0,f.tZ)(w.xu,{"data-test-id":"".concat(u,"-price-item-value-with-discount"),as:"span",ml:"global.xxs",color:"shared-alias.negative.foreground.default",fontWeight:"body-bold",children:p})]})})]})},ts=function(e){var t=e.price,r=e.paidPrice,n=e.hasDiscount,o=e.isFetchingPrices,i=(0,O.ZP)(j).translate,a=D(t),u=D(r),c=i("features.checkout-drawer-order-summary.gift-card");return(0,f.tZ)(tl,{dataTestId:"order-summary-drawer-feature-gift-card-price",label:c,price:a,rawPrice:t,priceWithDiscount:u,isDiscount:n,isFetchingPrices:o})},td=function(e,t){document.getElementById("satisfaction-guaranteed-messaging")&&(e({event:"gaEventTrigger",eventName:"Checkout_SatisfactionGuaranteedBannerDisplay",gaEventCategory:"SatisfactionGuaranteedBannerDisplay",gaEventAction:"",gaEventLabel:""}),t("Checkout_SatisfactionGuaranteedBannerDisplay",{EventCategory:"SatisfactionGuaranteedBannerDisplay",EventAction:"",EventLabel:""}))},tp=r(533048),tf=r(408558),tm=function(){var e=(0,tf.iQ)(),t=(0,ec.Z)(),r=(0,ep.Z)(),n=(0,ed.t)(),o=(0,P.Z)().push,i=(0,ef.py)({runUsingStatsig:!0}).track,a=(0,eY.O)(),u=a.id,c=a.attributes;return{handleCartDrawerOpen:(0,m.useCallback)(function(){(null==e?void 0:e.isCartOpen)||null==e||e.toggleCartOpen(),o({event:"gaEventTrigger",event_name:"Navigation_Scroll",position:"".concat(null==t?void 0:t.toUpperCase(),"-PaymentPage-PriceInfoField"),event_category:"funnel",event_action:"clickPriceDrawer",gaEventLabel:"".concat(null==t?void 0:t.toUpperCase(),"-PaymentPage-PriceInfoField"),screen:null==n?void 0:n.asPath}),i({eventName:"CheckoutPayment_ClickOrderSummaryDrawer",experimentationUserId:u||"",experimentationUserAttributes:c,eventTags:{brand:r,tribe:"Conversions",EventCategory:"funnel",EventAction:"clickPriceDrawer",EventLabel:"".concat(null==t?void 0:t.toUpperCase(),"-PaymentPage-PriceInfoField"),screen:null==n?void 0:n.asPath}})},[e,t,r,null==n?void 0:n.asPath,o,i,u,c])}},th=function(e){var t=e.isDropdownOpen,r=e.variant,n=e.headerStyleAs,o=e.showNewSummaryUI,i=(0,O.ZP)(j).translate,a=tm().handleCartDrawerOpen,u=(0,m.useCallback)(function(){return(r===s.drawer||r===s.editable)&&t?"rotate(180deg)":"rotate(0deg)"},[r,t]);return(0,f.BX)(w.xu,{display:"flex",justifyContent:"space-between",alignItems:"center","data-test-id":"price-breakdown-header-top",children:[(0,f.tZ)(w.xv,{as:"h3",strong:!0,textAlign:"left",color:"shared-alias.neutral.foreground.default",styleAs:n,children:i(o?"features.checkout-drawer-order-summary.order-review-title":"features.checkout-drawer-order-summary.order-summary")}
1),o?(0,f.tZ)(w.xu,{as:"button",alignSelf:"flex-end",transition:"transform .1s ease-in-out",marginLeft:"xs",textDecorationLine:"underline",borderStyle:"none",background:"transparent","aria-label":"Manage order items",cursor:"pointer",onClick:a,children:(0,f.tZ)(w.xv,{type:"body-sm-regular",children:i("features.checkout-drawer-order-summary.order-review-manage-promo-link")})}):r!==s.fixed&&(0,f.tZ)(w.xu,{alignSelf:"flex-end",transition:"transform .1s ease-in-out",transform:u(),marginLeft:"xs",children:(0,f.tZ)(w.JO,{icon:(0,f.tZ)(tp.default,{}),color:"shared-alias.neutral.foreground.default"})})]})},tg=function(e){var t=e.children,r=e.shouldAnimate,n=(0,w.q_)(r?{from:{transform:"translate3d(0, -30%, 0)"},to:{transform:"translate3d(0, 0%, 0)"},config:{duration:350,easing:w.Gk.linear}}:{});return(0,f.tZ)(w.q.div,{style:n,children:t})};function tb(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function tv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function ty(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function tw(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tb(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var tP=function(e){var t=e.children,r=e.specs,n=e.numberOfServings,o=e.productSku,i=e.couponCode,a=e.pricePerServing,u=e.discountedPricePerServing,c=e.price,l=e.paidPrice,d=e.finalPrice,p=e.grandTotal,h=e.hasDiscount,g=e.variant,b=void 0===g?s.drawer:g,v=e.giftCardOptions,y=e.hideHeader,x=void 0!==y&&y,O=e.onClickOrderSummary,S=e.isHFDefaultGlobalFlow,k=e.isFetchingPrices,C=e.isProgramsProduct,D=e.shouldDisplaySatisfactionGuaranteed,j=e.renderSatisfactionGuaranteedFeature,Z=e.headerStyleAs,_=e.showNewSummaryUI,A=e.isPriceFetched,E=e.hideFreeAddonOfferDetails,I=e.onVoucherSubmit,T=e.isGiftWithPurchaseEnabled,F=tw((0,m.useState)(!1),2),B=F[0],V=F[1],M=(0,P.Z)().push,W=eK().trackStatsigEvents,U=tw((0,m.useState)(b===s.fixed||!!T),2),X=U[0],R=U[1],L=eA().trackNavigation,N=(0,m.useCallback)(function(){X||L(),R(!X),O&&O(X)},[X,L,O]),G=(0,m.useCallback)(function(){T?O&&O():b===s.drawer||b===s.editable?N():O&&O()},[N,O,b,T]);return(0,m.useEffect)(function(){R(b===s.fixed||!!T)},[b,T]),(0,m.useEffect)(function(){B||(td(M,W),V(!0))},[B,M,W]),(0,f.BX)(w.xu,ty(tv({},(D||!!j)&&{backgroundColor:"alias.page-background.default"}),{filter:A?"none":"blur(4px)",opacity:A?1:.8,pointerEvents:A?"auto":"none",transition:"all 0.2s ease-in-out",children:[(0,f.BX)(w.xu,ty(tv({as:b!==s.fixed?"button":"div"},b!==s.fixed?{"aria-expanded":!s.drawer||X,onClick:G}:{}),{"data-test-id":"order-summary-drawer-feature-price-breakdown",width:"100%",borderWidth:0,cursor:b!==s.fixed?"pointer":"inherit",backgroundColor:"alias.page-background.default",px:"global.none",paddingTop:x?"global.none":"global.sm-2",paddingBottom:X?"global.sm-1":"global.none",position:"relative",children:[(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-feature-price-breakdown-header",children:[!x&&(0,f.tZ)(th,{isDropdownOpen:X,variant:b,headerStyleAs:Z,showNewSummaryUI:_}),(null==v?void 0:v.isGiftCardBuyer)?(0,f.tZ)(f.HY,{children:!X&&(0,f.tZ)(w.xu,{mt:"global.sm-1",mb:"global.sm-2",children:(0,f.tZ)(ts,{price:c,paidPrice:l,hasDiscount:h,isFetchingPrices:k})})}):(0,f.tZ)(tc,{isDropdownOpen:X,couponCode:i,productSku:o,numberOfServings:n,hasDiscount:h,specs:r,pricePerServing:a,discountedPricePerServing:u,finalPrice
1:d,grandTotal:p,paidPrice:l,subTotal:c,isHFDefaultGlobalFlow:S,isFetchingPrices:k,hideHeader:x,isProgramsProduct:C,showNewSummaryUI:_,price:c,hideFreeAddonOfferDetails:E,onVoucherSubmit:I,isGiftWithPurchaseEnabled:T})]}),!X&&!C&&!E&&(0,f.tZ)(w.xu,{marginX:"global.none",mb:["global.sm-2","global.sm-2","global.none"],children:(0,f.tZ)(K,{voucherCode:i,productSku:o,showNewSummaryUI:_})})]})),X&&!_&&(0,f.tZ)(tg,{shouldAnimate:X&&(D||!!j),children:(0,f.tZ)(w.xu,ty(tv({"data-test-id":"order-summary-drawer-feature-price-details",display:"grid",gridTemplateColumns:"1fr",gap:"global.xs",pb:"global.sm-2"},T&&{borderWidth:"global.xs",borderColor:"global.hellofresh.layout-cream.300",borderStyle:"solid",borderRadius:"global.md",px:"global.sm-2",pt:"global.sm-2",pb:"global.none",overflow:"hidden"}),{children:t}))})]}))},tx=r(405797),tO=function(e){var t=e.price,r=e.paidPrice,n=e.hasDiscount,o=e.isFetchingPrices,i=e.isProgramsProduct,a=(0,O.ZP)(j).translate,u=D(t),c=D(r),l=a(i?"features.checkout-drawer-order-summary.programs.box-price":"features.checkout-drawer-order-summary.box-price"),s=(0,m.useMemo)(function(){return n&&t>r},[r,t,n]);return(0,f.tZ)(tl,{dataTestId:"order-summary-drawer-feature-box-price",label:l,price:u,rawPrice:t,priceWithDiscount:c,rawPriceWithDiscount:r,isDiscount:s,isFetchingPrices:o})},tS=function(e){var t,r,n,o=e.productSku,i=e.couponCode,a=e.hasDiscount,u=e.discountAmount,c=e.isFetchingPrices,l=(0,U.m)({productSkus:[o],voucherCode:i},{enabled:!!i&&!!o,suspense:!1}).data,s=(0,O.ZP)(j).translate,d="-".concat(D(u)),p=(null==l?void 0:null===(n=l.presets)||void 0===n?void 0:null===(r=n[o]
1)||void 0===r?void 0:null===(t=r.e2e_discount_order_summary_offer)||void 0===t?void 0:t["1"])||s("features.checkout-drawer-order-summary.discount.label");return p&&a?(0,f.tZ)(tl,{dataTestId:"order-summary-drawer-feature-gwp-discount",label:p,price:d,rawPrice:-u,isFetchingPrices:c}):null},tk=function(e){var t=e.shippingAmount,r=e.standardShippingAmount,n=e.hasDiscount,o=e.applangaOverwrite,i=e.giftCardOptions,a=e.isFetchingPrices,u=(0,O.ZP)(j).translateRaw,c=n&&r>0&&t<r,l=D(r),s=c||0!==r?l:u(F),d=D(t),p=u((0,m.useCallback)(function(){return(null==i?void 0:i.isGiftCardBuyer)?"features.checkout-drawer-order-summary.gift-card.shipping":o?"".concat(A).concat(o):A},[o,null==i?void 0:i.isGiftCardBuyer])());return(0,f.tZ)(tl,{dataTestId:"order-summary-drawer-feature-shipping",label:p,price:s,rawPrice:r,priceWithDiscount:d,rawPriceWithDiscount:t,isDiscount:c,isFetchingPrices:a})},tC=function(e){var t,r,n=e.finalPrice,o=e.grandTotal,i=e.hasDiscount,a=e.applangaOverwrite,u=e.giftCardOptions,c=e.chargeAtCheckout,l=e.isFetchingPrices,s=e.isProgramsProduct,d=e.showNewSummaryUI,p=e.location,h=e.isGiftWithPurchaseEnabled,g=e.isOneTimePurchase,b=(0,O.ZP)(j),v=b.translate,y=b.translateRaw,P=D(n),x=D(o),S=i&&0===o?v(F):x,k=i&&0===o?y(F):x,C=y(_,{discountedPrice:k,originalPrice:P}),Z=(0,m.useCallback)(function(){return g?"features.checkout-drawer-order-summary.total.title.odp":(null==u?void 0:u.isGiftCardBuyer)||h?"features.checkout-drawer-order-summary.gift-card.total":c?"features.checkout-drawer-order-summary.chargeAtCheckout.total":a?"".concat(E).concat(a):E},[g,a,null==u?void 0:u.isGiftCardBuyer,c,h]),A=v(s?"reactivation"===p?"features.checkout-drawer-order-summary.programs.total.reactivation":"features.checkout-drawer-order-summary.programs.total.title":Z());return(0,f.BX)(w.xu,(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({"data-test-id":"order-summary-drawer-feature-box-total",display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:"headline",lineHeight:"line-height-md-1"},h&&{backgroundColor:"global.cream.200",px:"global.sm-2",py:"global.xs"}),r=r={style:h?{marginLeft:"-1rem",marginRight:"-1rem"}:void 0,children:[(0,f.tZ)(w.xv,{"data-test-id":"order-summary-drawer-feature-box-total-label",type:"body-md-bold",color:"shared-alias.neutral.foreground.default",children:A}),!i&&(0,f.tZ)(w.xu,{children:(0,f.tZ)(w.xv,{strong:!0,"data-test-id":"order-summary-drawer-feature-box-total-value",color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:Q(x,l)})}),i&&l&&(0,f.tZ)(w.xv,{color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",strong:d,children:Q(P,l)}),i&&!l&&(0,f.tZ)(w.xv,{role:"group","aria-label":C,color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",strong:d,children:(0,f.BX)(w.xu,{as:"span","aria-hidden":"true",children:[(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-box-total-value",as:"span",textDecorationLine:"line-through",children:P}),(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-box-total-value-with-discount",as:"span",ml:"global.xxs",color:"shared-alias.negative.foreground.default",fontWeight:"body-bold",children:S})]})})]},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))},tD=r(23287),tj=r(40412),tZ=r.n(tj),t_=r(268481);function tA(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function tE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);
1if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tA(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var tI=function(e){var t,r=e.couponCode,n=e.productSku,o=e.numberOfServings,i=e.grandTotal,a=e.price,u=e.shippingAmount,c=e.hasDiscount,l=e.onVoucherSubmit,s=e.onClickPromoCode,p=e.promoCodePosition,h=void 0===p?d.bottom:p,g=e.subscriptionId,b=e.customerId,v=e.skipVoucherValidationOnSubmit,y=e.uncollapsePromoCodeSection,P=e.location,x=e.headerStyleAs,S=e.customerUuid,k=e.customerPlanId,C=tE((0,m.useState)(y),2),D=C[0],Z=C[1],_="mobile"===(0,t_.Sj)(),A=(0,O.ZP)(j),E=A.translate,T=A.translateRaw,F=eA(),B=F.trackPromoCodeDrawerState,V=F.trackPromoCodeFieldInView,M=tE((0,m.useState)(!1),2),W=M[0],U=M[1],X=(0,m.useCallback)(function(){Z(!D),B(D),s&&s(D)},[D,s,B]);return(0,m.useEffect)(function(){y&&Z(y)},[y]),(0,f.BX)(f.HY,{children:[(0,f.tZ)(w.xu,{as:"button","data-test-id":"order-summary-drawer-feature-promo-code-".concat(h),width:"100%","aria-expanded":D,"aria-label":T(I),borderWidth:0,cursor:"pointer",pt:"global.sm-2",pb:D?"global.xxs":"global.sm-2",position:"relative",onClick:X,backgroundColor:"alias.page-background.default",px:"global.none",children:(0,f.BX)(w.xu,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,f.tZ)(w.xv,{as:"h3",styleAs:x,strong:!0,textAlign:"left",color:"shared-alias.neutral.foreground.default",children:E(I)}),(0,f.BX)(w.xu,{display:"flex",flexDirection:"row",children:[!!r&&c&&(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-promo-checkmark",children:(0,f.tZ)(w.JO,{icon:(0,f.tZ)(tD.default,{}),color:"alias.interactive.foreground.default"})}),(0,f.tZ)(w.xu,{alignSelf:"flex-end",transition:"transform .1s ease-in-out",transform:D?"rotate(180deg)":"rotate(0)",marginLeft:"global.xs",children:(0,f.tZ)(w.JO,{icon:(0,f.tZ)(tp.default,{})})})]})]})}),D&&(t=(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-promo-code-form",py:"global.sm-2",children:(0,f.tZ)(eq,{couponCode:r,price:a,productSku:n,numberOfServings:o,grandTotal:i,shippingAmount:u,onVoucherSubmit:l,subscriptionId:g,customerId:b,skipVoucherValidationOnSubmit:v,location:P,customerUuid:S,customerPlanId:k})}),_?(0,f.tZ)(tZ(),{onChange:function(e){_&&e&&!W&&(U(!0),V())},active:!W&&D,partialVisibility:!1,minTopValue:0,threshold:1,children:t}):t)]})},tT=r(749427),tF=function(e){var t=e.premiumShippingAmount,r=e.isFetchingPrices,n=(0,O.ZP)(j),o=n.translate,i=n.translateRaw,a=(0,v.D)().showPremiumShippingTooltip,u=D(t),c=o("features.checkout-drawer-order-summary.additional-shipping.title"),l=i("features.checkout-drawer-order-summary.additional-shipping.tooltip");return(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-feature-premium-shipping-amount",display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:"headline",lineHeight:"line-height-md-1",children:[(0,f.BX)(w.xu,{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"global.xxs",children:[(0,f.tZ)(w.xv,{"data-test-id":"order-summary-drawer-feature-premium-shipping-label",type:"body-md-regular",children:c}),a&&(0,f.tZ)(w.u,{"data-test-id":"order-summary-drawer-feature-premium-shipping-tooltip",content:l,asChild:!0,trigger:(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-premium-shipping-tooltip-icon",color:"shared-alias.neutral.foreground.default",display:"flex",mt:"global.xxs",cursor:"pointer",children:(0,f.tZ)(tT.Z,{})}),variant:"dark",position:"top",placement:"center"})]}),(0,f.tZ)(w.xu,{children:(0,f.tZ)(w.xv,{strong:!0,color:"shared-alias.neutral.foreground.default",whiteSpace:"nowrap",children:(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-premium-shipping-value",as:"span",color:"shared-alias.neutral.foreground.default",children:Q(u,r)})})})]})},tB=function(e){var t=e.taxAmount,r=e.isFetchingPrices,n=(0,O.ZP)(j).translate,o=D(t),i=n("features.checkout-drawer-order-summary.tax.title");return(0,f.tZ)(tl,{dataTestId:"order-summary-drawer-feature-tax-amount",label:i,price:o,rawPrice:t,isFetchingPrices:r})},tV=function(){var e=(0,O.ZP)(j).translateRaw;return(0,f.tZ)(w.gb,{"data-test-id":"order-summary-drawer-feature-promo-code-applied-banner",variant:"success",align:"center",children:(0,f.BX)(w.xu,{display:"flex",alignItems:"center",justifyContent:"center",lineHeight:"line-height-md-1",fontSize:"body-md-regular",children:[(0,f.tZ)(en.default,{}),(0,f.tZ)(w.xv,{ml:"xs",children:e("features.checkout-drawer-order-summary.banner-promo-code-applied")})]})})},tM={":hover":{cursor:"pointer",color:"alias.brand.foreground.darker"},":disabled":{cursor:"default",opacity:".4",textDecorationLine:"underline"}},tW=function(e){var t=e.onClickChange,r=(0,O.ZP)(j).translateRaw,n=(0,m.useCallback)(function(){t&&t()},[t]);return(0,f.tZ)(w.xu,{as:"button","data-test-id":"order-summary-drawer-feature-change-promo-code-button",pseudo:tM,background:"none",padding:"xs",color:"alias.brand.foreground.default",borderWidth:0,textDecorationLine:"underline",onClick:n,children:(0,f.tZ)(w.xv,{color:"inherit",children:r("features.checkout-drawer-order-summary.change-promo-code-applied")})})};function tU(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var tX=function(e){var t,r=e.couponCode,n=e.price,o=e.numberOfServings,i=e.grandTotal,a=e.shippingAmount,u=e.productSku,c=e.onVoucherSubmit,l=e.onClickChange,s=e.subscriptionId,d=e.customerId,p=e.location,h=function(e){if(Array.isArray(e))return e}(t=(0,m.useState)(!1))||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),2!==i.length);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return tU(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);
1if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tU(e,2)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=h[0],b=h[1],v=(0,ec.Z)(),y=(0,eu.W)({country:v,code:r,products:[u],customer_id:d||0,subscription_id:Number(s)||0},{enabled:!!r,suspense:!1}).status,P=(0,m.useCallback)(function(){b(!0),l&&l()},[l]),x=(0,m.useCallback)(function(e){b(!1),c&&c(e)},[c]);return"success"!==y?null:(0,f.tZ)(f.HY,{children:g?(0,f.tZ)(w.xu,{mt:"global.sm-1",children:(0,f.tZ)(eq,{focusOnMount:!0,price:n,couponCode:r,productSku:u,numberOfServings:o,grandTotal:i,shippingAmount:a,onVoucherSubmit:x,location:p})}):(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-feature-promo-code-applied-section",display:"flex",alignItems:"center",justifyContent:"space-between",mt:"xs",children:[(0,f.tZ)(tV,{}),(0,f.tZ)(tW,{onClickChange:P})]})})},tR=r(129389),tL=function(e){var t=e.name,r=e.email,n=(0,O.ZP)(j).translate;return t||r?(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-feature-gift-card-recipient",children:[(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-gift-card-recipient-title",mb:"global.xxs",children:(0,f.BX)(w.xv,{type:"body-md-bold",children:[" ",n("features.checkout-drawer-order-summary.recipient-information")," "]})}),(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-gift-card-recipient-name",mb:"global.xxs",children:(0,f.BX)(w.xv,{type:"body-md-regular",children:[" ",t," "]})}),(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-gift-card-recipient-email",mb:"xs",children:(0,f.BX)(w.xv,{type:"body-md-regular",children:[" ",r," "]})})]}):null},tN=function(){var e=(0,O.ZP)("features.checkout-drawer-order-summary").translateRaw;return(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-satisfaction-guaranteed-messaging",py:"global.xxs",my:"global.sm-1",children:(0,f.BX)(w.xu,{display:"flex",gap:"global.sm-1",alignItems:"center",backgroundColor:"global.hellofresh-lime.200",borderRadius:"border-radius-sm",px:"global.xs",py:"global.xxs",mb:"global.xxs",children:[(0,f.tZ)(w.xu,{"data-test-id":"order-summary-drawer-feature-satisfaction-guaranteed-illustration",children:(0,f.tZ)(G.ZP,{alt:"ingredient-box-image",quality:"100",width:"48",height:"48",src:(0,H.Z)("https://cdn.hellofresh.com/us/checkout-fragment/3d/IngredientBox.png")})}),(0,f.BX)(w.xu,{display:"flex",flexDirection:"column",alignItems:"left",children:[(0,f.tZ)(w.xv,{type:"body-md-bold",children:e("features.checkout-drawer-order-summary.satisfaction-guaranteed.title")}),(0,f.tZ)(w.xv,{type:"body-sm-regular",children:e("features.checkout-drawer-order-summary.satisfaction-guaranteed.text")})]})]})})};function tG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var tH=function(e){var t,r,n,o,i=(0,tx.Z)(e),a=i.specs,u=i.numberOfServings,c=i.price,l=i.priceId,s=i.paidPrice,p=i.pricePerServing,h=i.finalPrice,g=i.grandTotal,v=i.discountedPricePerServing,P=i.hasDiscount,x=i.shippingAmount,O=i.standardShippingAmount,S=i.premiumShippingAmount,k=i.taxAmount,D=i.isFetchingPrices,j=i.isPriceFetched,Z=eA(),_=Z.trackUserSawPrice,A=Z.trackWidgetUserSawPrice,E=(0,C.SX)(),I=(0,m.useMemo)(function(){return!(null==e?void 0:e.hidePromoCode)},[e.hidePromoCode]),T=(0,m.useMemo)(function(){return(null==e?void 0:e.promoCodePosition)||d.bottom},[e.promoCodePosition]),F=(0,m.useMemo)(function(){return I&&T===d.top},[I,T]),B=(0,m.useMemo)(function(){return I&&T===d.bottom},[I,T]),V=(0,m.useMemo)(function(){return{couponCode:e.couponCode,productSku:e.productSku,price:c,hasDiscount:P,numberOfServings:u,grandTotal:g,shippingAmount:x,onVoucherSubmit:e.onVoucherSubmit,onClickPromoCode:e.onClickPromoCode,promoCodePosition:T,subscriptionId:e.subscriptionId,customerId:e.customerId,skipVoucherValidationOnSubmit:e.skipVoucherValidationOnSubmit,uncollapsePromoCodeSection:e.uncollapsePromoCodeSection||!1,location:e.location,headerStyleAs:e.headerStyleAs,customerUuid:e.customerUuid,customerPlanId:e.planID}},[e.couponCode,e.productSku,e.onVoucherSubmit,e.onClickPromoCode,c,P,u,g,x,T,e.subscriptionId,e.customerId,e.skipVoucherValidationOnSubmit,e.uncollapsePromoCodeSection,e.location,e.headerStyleAs,e.customerUuid,e.planID]);(0,m.useEffect)(function(){if(g&h&&(_({totalPrice:c,totalPriceWithDiscount:s,pricePerServing:p,discountedPricePerServing:v,totalBoxPrice:g,totalBoxPriceWithDiscount:h,totalShippingPrice:O,totalShippingPriceWithDiscount:x,voucher:e.couponCode,sku:e.productSku}),g>0&&c>0&&p>0)){var t=(0,tR.P)();A(tG({totalPrice:h.toFixed(2),totalPriceWithDiscount:g.toFixed(2),shippingFee:O.toFixed(2),price:c.toFixed(2),priceWithDiscount:s.toFixed(2),pricePerServing:p.toFixed(2),discountPricePerServing:v.toFixed(2),shippingDiscount:(O-x).toFixed(2),sku:e.productSku,couponCode:e.couponCode,zipCode:y.ZP.getItem("encryptedZipcode")||"",widget:"orderSummaryAddress",currencyCode:E,productPriceId:l},t&&{requestId:t}))}},[c,l,E,h,s,g,p,v,O,x,e.couponCode,e.productSku,_,A]),(0,m.useEffect)(function(){e.couponCode&&P&&e.onValidPromoCode&&e.onValidPromoCode()},[e.couponCode,P]);var M=(0,b.zv)();return(0,f.BX)(w.xu,{"data-test-id":"order-summary-drawer-container",px:"global.sm-2",backgroundColor:"alias.page-background.default",children:[F&&(0,f.tZ)(w.xu,{mb:"global.sm-2",children:(0,f.tZ)(tI,tG({},V))}),e.contentAboveOrderSummary,!e.hideOrderSummary&&(0,f.BX)(tP,{specs:a,productSku:e.productSku,numberOfServings:u,couponCode:e.couponCode,price:c,paidPrice:s,pricePerServing:p,discountedPricePerServing:v,finalPrice
1:h,grandTotal:g,hasDiscount:P,variant:null==e?void 0:e.variant,hideHeader:null==e?void 0:e.hideHeader,giftCardOptions:e.giftCardOptions,onClickOrderSummary:null==e?void 0:e.onClickOrderSummary,isHFDefaultGlobalFlow:e.isHFDefaultGlobalFlow,isFetchingPrices:D,isProgramsProduct:e.isProgramsProduct,isPriceFetched:j,shouldDisplaySatisfactionGuaranteed:null==e?void 0:e.shouldDisplaySatisfactionGuaranteed,renderSatisfactionGuaranteedFeature:null==e?void 0:e.renderSatisfactionGuaranteedFeature,showNewSummaryUI:e.showNewSummaryUI,headerStyleAs:e.headerStyleAs,hideFreeAddonOfferDetails:e.hideFreeAddonOfferDetails,onVoucherSubmit:e.onVoucherSubmit,isGiftWithPurchaseEnabled:e.isGiftWithPurchaseEnabled,children:[(null===(n=e.giftCardOptions)||void 0===n?void 0:n.isGiftCardBuyer)&&(0,f.tZ)(tL,{name:e.giftCardOptions.recipientName,email:e.giftCardOptions.recipientEmail}),!M&&(0,f.tZ)(w.iz,{"data-test-id":"order-summary-drawer-container-divider-top",my:"global.none",mx:"global.none"}),(null===(o=e.giftCardOptions)||void 0===o?void 0:o.isGiftCardBuyer)?(0,f.tZ)(ts,{price:c,paidPrice:s,hasDiscount:P,isFetchingPrices:D}):(0,f.tZ)(tO,{price:c,paidPrice:s,hasDiscount:!e.isGiftWithPurchaseEnabled&&P,isFetchingPrices:D,isProgramsProduct:e.isProgramsProduct}),e.isGiftWithPurchaseEnabled&&(0,f.tZ)(tS,{productSku:e.productSku,couponCode:e.couponCode,hasDiscount:P,discountAmount:c-s,isFetchingPrices:D}),(0,f.tZ)(tk,{shippingAmount:x,standardShippingAmount:O,hasDiscount:P,applangaOverwrite:null==e?void 0:e.importedFrom,giftCardOptions:e.giftCardOptions,isFetchingPrices:D}),!!S&&(0,f.tZ)(tF,{premiumShippingAmount:S,isFetchingPrices:D}),!!k&&(0,f.tZ)(tB,{taxAmount:k,isFetchingPrices:D}),!M&&(0,f.tZ)(w.iz,{"data-test-id":"order-summary-drawer-container-divider-bottom",my:"global.xxs",mx:"global.none"}),!e.showNewSummaryUI&&(0,f.tZ)(tC,{hasDiscount:P,finalPrice:h,grandTotal:g,applangaOverwrite:null==e?void 0:e.importedFrom,giftCardOptions:e.giftCardOptions,chargeAtCheckout:e.chargeAtCheckout,isFetchingPrices:D,isProgramsProduct:e.isProgramsProduct,location:e.location,isGiftWithPurchaseEnabled:e.isGiftWithPurchaseEnabled,isOneTimePurchase:e.isOneTimePurchase}),e.showPromoAppliedSection&&!!e.couponCode&&(0,f.tZ)(tX,(t=tG({},V),r=r={onClickChange:e.onChangeAppliedPromoCode},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))]}),(null==e?void 0:e.shouldDisplaySatisfactionGuaranteed)&&(0,f.tZ)(tN,{}),e.renderSatisfactionGuaranteedFeature,B&&(0,f.tZ)(w.xu,{mt:e.shouldDisplaySatisfactionGuaranteed?"global.xxs":"global.sm-2",children:(0,f.tZ)(tI,tG({},V))})]})},tq=r(204600),tJ=function(){var e=(0,O.ZP)(j).translateRaw;return(0,v.D)().showCancellationDisclaimer?(0,f.BX)(w.xu,{boxShadow:"shadow-md","data-test-id":"summary-bottom-order-summary-drawer-feature-cancellation-disclaimer",marginTop:"global.sm-2",backgroundColor:"shared-alias.negative.background.lightest",borderRadius:"border-radius-sm",padding:"global.xs",display:"flex",alignItems:"center",justifyContent:"center",children:[(0,f.tZ)(w.xu,{marginRight:"global.xxs",children:(0,f.tZ)(tq.default,{"data-test-id":"summary-bottom-order-summary-drawer-feature-cancellation-truck-icon",title:"delivery-truck-icon"})}),(0,f.tZ)(w.xv,{type:"body-sm-regular",children:(0,f.tZ)(w.xu,{fontSize:["body-xs-regular","body-sm-regular"],children:(0,f.tZ)(x.Z,{hasMarkdown:!0,copy:e("features.checkout-drawer-order-summary.cancellation-disclaimer-text")})})})]}):null};(i=s||(s={})).drawer="drawer",i.editable="editable",i.fixed="fixed",(a=d||(d={})).top="top",a.bottom="bottom",(u=p||(p={})).reactivations=".reactivations",u.one_time_purchase=".one-time-purchase";var tz=function(e){var t,r,n=(0,b.zv)();return(0,f.tZ)(g.Z,{claim:{name:"activations-mealkits",githubTeam:"hellofresh/squad-checkout",tribe:"conversions",alliance:"growth",jiraPrefix:"UFI",slackChannel:"#squad-checkout",slackAlertsChannel:"#ufi-private",ski
1pLabelsOnPR:!0,teamIdentifier:"activations-mealkits"},children:(0,f.tZ)(h.Z,{scope:"feature.checkout-order-summary-drawer",children:(0,f.BX)(v.Z.ProjectConfigProvider,{children:[(0,f.tZ)(tH,(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),r=r={isVDS:n},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t)),(0,f.tZ)(tJ,{})]})})})}},389905:function(e,t,r){function n(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}r.d(t,{D:function(){return a}});var o,i=(0,r(575085).Z)("order-summary-drawer-feature-config",(o=function(){return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,function(e){switch(e.label){case 0:return[4,r.e(46508).then(r.bind(r,446508))];case 1:return[2,e.sent()]}})},function(){var e=this,t=arguments;return new Promise(function(r,i){var a=o.apply(e,t);function u(e){n(a,r,i,u,c,"next",e)}function c(e){n(a,r,i,u,c,"throw",e)}u(void 0)})})),a=i.useConfig;t.Z=i},405797:function(e,t,r){r.d(t,{Z:function(){return h}});var n=r(827378),o=r(736026),i=r(141323),a=r(72065),u=r(10198),c=r(543978),l=function(e){var t=e.productSku,r=e.customer,n=e.couponCode,o=e.planID,i=e.deliveryDate,a=e.deliveryOption,u=e.hfWeek,c=e.shippingAddress;return{products:[{handle:t}],customerUUID:(null==r?void 0:r.uuid)||"",voucherCode:n||"",planID:o||"",delivery:{handle:a||"",date:i||"",hfWeek:u||""},shippingAddress:c&&function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},c)||{}}},s=r(389905),d=r(799146),p=r(256130);function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var m=function(e){var t,r=e.couponCode,o=e.productSku,m=e.shippingAddress,h=e.deliveryDate,g=e.deliveryOption,b=e.hfWeek,v=e.skipOneOffCalculation,y=e.planID,w=e.location,P=e.subscriptionId,x=e.checkoutType,O=e.checkoutHeaders,S=!!(w&&"checkout"===w),k=!!(w&&"reactivation"===w),C=(null==o?void 0:o.length)>0,D=(0,s.D)().defaultPostcode,j=(0,d.B)(k?p.d.REACTIVATION_SUBSCRIPTION:p.d.ACTIVATION_SUBSCRIPTION),Z=(0,n.useMemo)(function(){if(null==m?void 0:m.postcode)return m;if(D){var e,t;return e=f({},m),t=t={postcode:D},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}
1)(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}return m},[m,D]),_=(0,i.j)({},{suspense:!1}).data,A=(0,a.vr)(f({products:[{handle:o,deliveryDate:h,deliveryOption:g,hfWeek:b}],customerID:parseInt((null==_?void 0:_.id)||"0"),couponCode:r,shippingAddress:Z&&f({},Z),skipOneOffCalculation:v,planID:y},k&&P&&{subscriptionID:parseInt(P.toString(),10)}),{enabled:C&&!S&&!k,suspense:!1}),E=A.data,I=A.isFetching,T=A.isSuccess,F=(0,u.vr)(f({products:[{handle:o,deliveryDate:h,deliveryOption:g,hfWeek:b}],customerID:parseInt((null==_?void 0:_.id)||"0"),customerUUID:null!==(t=null==_?void 0:_.uuid)&&void 0!==t?t:"",couponCode:r,shippingAddress:Z,skipOneOffCalculation:v,planID:y},x&&{checkoutType:x},(j||O)&&{headers:f({},j,O)}),{enabled:S&&!!(null==o?void 0:o.length)&&!!h&&!!g,suspense:!1}),B=F.data,V=F.isFetching,M=F.isSuccess,W=(0,c.d)(f({},l({productSku:o,customer:_,couponCode:r,planID:y,deliveryDate:h,deliveryOption:g,hfWeek:b,shippingAddress:Z}),(j||O)&&{headers:f({},j,O)}),{enabled:k&&!!(y&&(null==_?void 0:_.uuid)&&P&&C&&g),suspense:!1}),U=W.data,X=W.isFetching,R=W.isSuccess;return{calculatedPrices:(0,n.useMemo)(function(){return S?B:k?U:E},[B,E,U,S,k]),isFetchingPrices:I||V||X,isSuccess:M||T||R}},h=function(e){var t=e.couponCode,r=e.productSku,i=e.shippingAddress,a=e.deliveryDate,u=e.deliveryOption,c=e.hfWeek,l=e.skipOneOffCalculation,s=e.planID,d=e.onPriceCalculated,p=e.location,f=e.subscriptionId,h=e.checkoutType,g=e.checkoutHeaders,b=e.isStandardShippingWaived,v=m({couponCode:t,productSku:r,shippingAddress:i,deliveryDate:a,deliveryOption:u,hfWeek:c,skipOneOffCalculation:l,planID:s,location:p,subscriptionId:f,checkoutType:h,checkoutHeaders:g}),y=v.calculatedPrices,w=v.isFetchingPrices,P=v.isSuccess,x=(0,o.D)({code:t},{suspense:!1}).data,O=(0,n.useMemo)(function(){return(null==y?void 0:y.subTotal)||0},[null==y?void 0:y.subTotal]),S=(0,n.useMemo)(function(){var e,t=null==y?void 0:null===(e=y.products)||void 0===e?void 0:e.find(function(e){return e.handle===r});return(null==t?void 0:t.priceId)||""},[null==y?void 0:y.products,r]),k=(0,n.useMemo)(function(){var e,t=null==y?void 0:null===(e=y.products)||void 0===e?void 0:e.find(function(e){return e.handle===r});return((null==t?void 0:t.unitPrice)||0)-((null==t?void 0:t.couponMoneyValue)||0)},[null==y?void 0:y.products,r]),C=(0,n.useMemo)(function(){var e;return(e=(null==r?void 0:r.split("-"))||[]).length<4?{meals:0,people:0}:{meals:Number(e[2]),people:Number(e[3])}},[r]),D=(0,n.useMemo)(function(){return C.meals*C.people||0},[C]),j=(0,n.useMemo)(function(){return D>0?O/D:0},[O,D]),Z=(0,n.useMemo)(function(){return(null==y?void 0:y.premiumShippingAmount)||0},[null==y?void 0:y.premiumShippingAmount]),_=(0,n.useMemo)(function(){return((null==y?void 0:y.shippingAmount)||0)-Z},[null==y?void 0:y.shippingAmount,Z]),A=b?_:(null==y?void 0:y.shippingDiscountAmount)||0,E=(0,n.useMemo)(function(){var e,t=(null==y?void 0:y.products)||[];return t.length>0?null===(e=t[0])||void 0===e?void 0:e.couponMoneyValue:0},[null==y?void 0:y.products]),I=(0,n.useMemo)(function(){return _-A},[_,A]),T=b?Math.max(0,((null==y?void 0:y.grandTotal)||0)-_):(null==y?void 0:y.grandTotal)||0,F=(0,n.useMemo)(function(){return(null==y?void 0:y.taxAmount)||0},[null==y?void 0:y.taxAmount]),B=(0,n.useMemo)(function(){return E>0?E/D:0},[E,D]),V=(0,n.useMemo)(function(){return A+E>0},[A,E]),M=(0,n.useMemo)(function(){return(null==y?void 0:y.discountAmount)||0},[null==y?void 0:y.discountAmount]),W=(0,n.useMemo)(function(){return O+_+F+Z},[O,_,F,Z]),U=(0,n.useMemo)(function(){return j-B},[j,B]),X=(0,n.useMemo)(function(){var e,t;return x&&(null==x?void 0:null===(e=x.discount_settings)||void 0===e?void 0:e.box_count)?null==x?void 0:null===(t=x.discount_settings)||void 0===t?void 0:t.box_count:0},[x]);return(0,n.useMemo)(function(){var e={specs:C,price:O,priceId:S,paidPrice:k,numberOfServings:D,pricePerServing:j,hasDiscount:V,discountAmount:M,standardShippingAmount:_,shippingAmount:I,premiumShippingAmount:Z,grandTotal:T,taxAmount:F,discountValuePerServing:B,finalPrice:W,discountedPricePerServing:U,discountBoxCount:X,isFetchingPrices:w,isPriceFetched:P};return d&&d(e),e},[C,S,O,k,D,j,V,M,_,I,Z,T,F,B,W,U,X,w,d,P])}},401524:function(e,t,r){function n(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}r.d(t,{Gi:function(){return a},Sc:function(){return u}});var o,i=(0,r(575085).Z)("hf.funnel.cart",(o=function(){return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,function(e){switch(e.label){case 0:return[4,r.e(20510).then(r.bind(r,420510))];case 1:return[2,e.sent().config]}})},function(){var e=this,t=arguments;return new Promise(function(r,i){var a=o.apply(e,t);function u(e){n(a,r,i,u,c,"next",e)}function c(e){n(a,r,i,u,c,"throw",e)}u(void 0)})})),a=i.ProjectConfigProvider,u=(i.configMiddleware,i.useConfig)},973524:function(e,t,r){var n=r(262978);t.Z=function(e){var t,r=e.voucherCode,o=(0,n.Z)({voucherCode:null!=r?r:""}),i=o.isFreeAddonVoucher,a=o.freeAddonVoucherDetails;if(!i)return{lifetimeVoucherInfo:{isEligible:!1},multiWeekVoucherInfo:{isEligible:!1,numberOfWeeks:0}};var u=!!i&&!!(null==a?void 0:a.isLifetime),c=i&&!u&&!!(null==a?void 0:a.numOfFreeWeeks);return{lifetimeVoucherInfo:{isEligible:!c&&u},multiWeekVoucherInfo:{isEligible:c,numberOfWeeks:null!==(t=null==a?void 0:a.numOfFreeWeeks)&&void 0!==t?t:0}}}},496329:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(581340),o=r(827378),i=r(953137),a=r(43011),u=r(718583),c=r(748966),l=function(e){var t,r=null==e?void 0:null===(t=e.split("?"))||void 0===t?void 0:t[1];if(!r)return{};try{var n=decodeURIComponent(r);return(0,c.parse)(n)}catch(e){return{}}},s=function(e){var t,r,c=(0,a.Z)(),s=(0,n.t)(),d=s.query,p=l(s.asPath),f=(0,o.useMemo)(function(){var e,t=u.ZP.getItem("hf_subscription_id");try{return t&&(null===(e=JSON.parse(t))||void 0===e?void 0:e.value)}catch(e){}},[]),m=(null==d?void 0:d.subscriptionId)||(null==p?void 0:p.subscriptionId)||f,h=(0,i.u)({},{suspense:!1,enabled:!!c}).data,g=null==h?void 0:h.items;if(!g)return!1;var b=void 0;m&&(b=g.find(function(e){return e.id===m})),b||(b=g.find(function(e){return!e.canceledAt})||g[0]);var v=!!(null==b?void 0:b.canceledAt);return e&&(v=(null===(r=b.productType)||void 0===r?void 0:null===(t=r.specs)||void 0===t?void 0:t.recurrency)===0&&!!(null==b?void 0:b.canceledAt)),v}},749427:function(e,t,r){var n=r(687800);function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}r(827378),t.Z=function(e){var t=e.title,r=e.titleId,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["title","titleId"]);return(0,n.BX)("svg",i(o(i(o({width:"1rem",height:"1rem",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:t?"img":"graphics-symbol",color:"inherit","aria-hidden":!t},!t&&{focusable:!1}),{"aria-labelledby":r}),a),{children:[t?(0,n.tZ)("title",{id:r,children:t}):null,(0,n.tZ)("path",{d:"M8 3.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM7.25 12.5v-6h1.5v6h-1.5Z",fill:"currentColor"}),(0,n.tZ)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0Zm-1.5 0a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Z",fill:"currentColor"})]}))}},962928:function(e,t,r){var n=r(687800);function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}r(827378),t.Z=function(e){var t=e.title,r=e.titleId,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["title","titleId"]);
1return(0,n.BX)("svg",i(o(i(o({width:"1rem",height:"1rem",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:t?"img":"graphics-symbol",color:"inherit","aria-hidden":!t},!t&&{focusable:!1}),{"aria-labelledby":r}),a),{children:[t?(0,n.tZ)("title",{id:r,children:t}):null,(0,n.tZ)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0Zm-4.552-3.5L4.5 10.448 5.552 11.5 11.5 5.552 10.448 4.5ZM7.256 6.141a1.115 1.115 0 1 1-2.23 0 1.115 1.115 0 0 1 2.23 0Zm2.603 4.833a1.115 1.115 0 1 0 0-2.23 1.115 1.115 0 0 0 0 2.23Z",fill:"currentColor"})]}))}},513630:function(e,t,r){r.r(t);var n=r(687800);function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}r(827378),t.default=function(e){var t=e.title,r=e.titleId,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["title","titleId"]);return(0,n.BX)("svg",i(o(i(o({width:"1.5rem",height:"1.5rem",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:t?"img":"graphics-symbol",color:"inherit","aria-hidden":!t},!t&&{focusable:!1}),{"aria-labelledby":r}),a),{children:[t?(0,n.tZ)("title",{id:r,children:t}):null,(0,n.tZ)("path",{d:"M16.647 7.732a.975.975 0 1 0-1.379-1.379.975.975 0 0 0 1.38 1.379Z",fill:"currentColor"}),(0,n.tZ)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.726 2 2 12.726 10.274 21 21 10.274l-1.073-7.201L12.726 2Zm6.2 7.59-8.652 8.652-5.516-5.516 8.652-8.652 4.801.715.715 4.8Z",fill:"currentColor"})]}))}},204600:function(e,t,r){r.r(t);var n=r(687800);function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}r(827378),t.default=function(e){var t=e.title,r=e.titleId,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["title","titleId"]);return(0,n.BX)("svg",i(o(i(o({width:"1.5rem",height:"1.5rem",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:t?"img":"graphics-symbol",color:"inherit","aria-hidden":!t},!t&&{focusable:!1}),{"aria-labelledby":r}),a),{children:[t?(0,n.tZ)("title",{id:r,children:t}):null,(0,n.tZ)("path",{d:"m4 4-.4 2h3.728l-.423 2H3.2l-.4 2h3.7l-.384 2H2.4L2 14h2v4h2.268a2 2 0 1 0 3.465 0h6.535a2 2 0 1 0 3.465 0H22v-6.461L17 6h-1v8H5.738l.378-2H14
1V4H4Z",fill:"currentColor"})]}))}}}]);

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.