import{Ft as e,Gt as n,It as t,Jt as i,Pt as r,Wt as o,bt as a,en as s,ft as l,jt as c,nn as d,xt as u,yt as m}from"./630ba094.L_X-5TXi.js";import{AO as h,Dp as p,Fc as y,Gg as f,HE as v,Ic as b,Lc as g,Mv as _,OO as P,Rc as x,Tp as C,Xg as T,Yf as w,_E as E,ay as L,cE as S,em as k,oy as I,wb as M,xO as D}from"./6ec9a0fa.rdcQt2v8.js";import{i as A,n as O,t as z}from"./53e8828a.X18bKQWI.js";import{n as B,t as j}from"./4c5b1c9e.BI54QL2K.js";function W(e){if(e.length<2)return!1;const n=e.map(e=>{const n=S(e);return n?L(n):void 0}),[t]=n;return Boolean(t&&n.every(e=>e===t))}function F(e){const n=[],t=new Map;for(const i of e){const e=_(i)??i.methods[0],r=e&&L(e),o=r?t.get(r):void 0;if(o)o.push(i);else{const e=[i];r&&t.set(r,e),n.push(e)}}return n.length===e.length?e:n.map(e=>{const n=e[0];return 1===e.length&&n?n:function(e){const n=I(e.map((e,n)=>({index:n,rate:e})),N).rate,t=e.flatMap(e=>e.targetMerchandiseLines??[]),i=_(n)??n.methods[0];return{...n,methods:i&&i!==n.methods[0]?[i,...n.methods.filter(e=>e!==i)]:n.methods,targetMerchandiseLines:t.length?t:n.targetMerchandiseLines}}(e)})}function N(e){const n=_(e)??e.methods[0],t=n?.priceBreakdown?.map(({amount:e})=>e.amount);return t?.length?Math.max(...t):n?.cost.amount??0}function H(e){const n=new Map;for(const t of e){const e=t.fields.id.value,i=t.fields.deliveryMethodHandle.value;e&&i&&n.set(e,i)}return n}function X(e,n){return e.map(e=>{const t=e.id?n.get(e.id):void 0;return{line:e,method:e.methods.find(({handle:e})=>e===t)}})}function G(e,n,t=(e,n)=>L(n)){const i=n.map(({line:e,method:n},i)=>({lineIndex:i,amountCombinabilityToken:n?t(e,n):void 0,amount:n?.cost.amount})),r=new Set;return e.forEach((e,n)=>{for(const o of e.methods){const a=o.cost.amount,s=t(e,o);s&&i.some(e=>e.lineIndex!==n&&e.amountCombinabilityToken===s&&void 0!==e.amount&&(e.amount>a||e.amount===a&&e.lineIndex({costBeforeDiscounts:e.cost.amount,cost:e.costAfterDiscounts.amount,amountCombinabilityToken:L(e)})));return{totalCost:{amount:t,currencyCode:n.cost.currencyCode},totalCostAfterDiscounts:{amount:i,currencyCode:n.costAfterDiscounts.currencyCode}}}var R=void 0,U=!0,V="small400";function Y({cost:e,costAfterDiscounts:n,included:t=!1,inlineDiscount:i,preDiscountCost:r=!1,styleOverrides:o={}}){const{shop:a,i18n:s}=D(),l=!a.hasFlagEnabled(v),{textSize:c=R,shouldBold:u=U,freeTextLetterCase:p="uppercase",costSpacing:y=V}=o,b=u?"strong":void 0,{amount:_}=e,{amount:P}=n,x=l&&_>P,T=e=>e?m(h,{accessibilityVisibility:"exclusive",children:e}):null,w=({cost:e,accessibilityContext:n,isOriginalPrice:t=!1})=>{const r=0===e.amount;let o=c;return t&&(o=i?"base":"small"),m(d,r?{children:[T(n),m(h,{type:b,size:o,letterCase:p,children:s.translate("shipping.free_rate_label")})]}:{children:[T(n),m(h,{type:t?"redundant":b,color:t?"subdued":void 0,size:o,translate:!1,children:s.formatCurrency(e.amount,{currency:e.currencyCode})})]})},E=w({cost:n,accessibilityContext:x?s.translate("order_summary.price_after_discount_aria_text"):void 0});if(t&&P>0){const e=w({cost:n,accessibilityContext:s.translate("order_summary.original_price"),isOriginalPrice:!0}),t=m(g,{size:c,strong:u});return m(f,i?{direction:"inline",display:"inline",gap:C(y),alignItems:"baseline",children:[e,t]}:{gap:C(y),alignItems:"end",children:[e,t]})}if(r)return w({cost:e,accessibilityContext:s.translate("order_summary.original_price")});if(x){const n=w({cost:e,accessibilityContext:s.translate("order_summary.original_price"),isOriginalPrice:!0});return m(f,i?{direction:"inline",display:"inline",gap:C(y),alignItems:"baseline",children:[n,E]}:{gap:C(y),alignItems:"end",children:[n,E]})}return E}var q=function(e){return e.Sync="Sync",e.Async="Async",e}({}),K=new Map([[E.BuyWithPrime,"Sync"],["shop_promise","Async"]]);function Q({show:t,children:r,from:a={opacity:0},to:s={opacity:1},options:l,onEnd:c,animateOnShow:d=!0}){const u=i(null),h=e(t),p=()=>{h.value=!1,c?.()},y={duration:500,fill:"forwards",...l};return n(()=>{if(h.value&&d){const e=u.current;if(e&&"function"==typeof e.animate)try{e.animate([a,s],y)}catch{}}},[h.value,d]),o(()=>{const e=u.current;if(t)h.value=!0;else if(e&&"function"==typeof e.animate)try{const n=e.animate([s,a],y);n&&(n.onfinish=p)}catch{p()}else p()},[t]),h.value?m("div",{ref:u,children:r}):null}var Z=a(function({timeInTransit:e,paragraphColor:n}){const t=k()(e);return null===t?null:m(w,{color:n,children:m("bdi",{children:t})})}),$=a(function({timeInTransit:e,title:n,paragraphColor:t}){return n?m(w,{color:t,children:m("bdi",{children:n})}):e?m(Z,{timeInTransit:e,paragraphColor:t}):null});function ee({deliveryMethod:n,deliveryExpectationLine:t,placeholderTitle:r,estimatedTimeInTransit:a,hideDescription:s,formatContent:l=e=>e,paragraphColor:u,size:h,estimateCounted:p}){const{deliveryPromiseTitle:y,deliveryPromisePlaceholderTitleShort:v,deliveryPromisePlaceholderTitle:b,deliveryPromiseTitleShort:g,shouldDisplayPlaceholderTitle:_}=B(n,t,r),x=e(Boolean(y)),C=i(_),E=i(!1),L=p??E,S=i(null),k=e(null),{theme:I}=O(k.value),{observability:M,checkout:A}=D(),{shippingAddress:W}=A.negotiator.parts,F="shop_promise"===t?.brandedPromise?.handle,N=ne(I,t?.brandedPromise?.handle),{short:H,long:X}=t?.deliveryExpectationPresentmentTitle||{};o(()=>{k.value=S.current},[S,k]),o(()=>{if(!L.current&&(H||X)){L.current=!0;const e=W.value.countryCode;M.counter({name:"estimated_delivery_date_rendered",value:1,attributes:{branded:String(F),...e&&{country_code:e}}})}},[H,X,F,W,M,L]);const G=y||g,J=b||v,R=n.description?.trim()||void 0;return G||J||F||R&&!s?l(m(f,{children:[(G||J||F)&&m("div",{className:c(j.ShopPromiseWrapper,"small"===h?j.WrapperHeightSmall:void 0),ref:S,children:[m(Q,{show:_&&!y,options:{duration:300},onEnd:()=>{x.value=!0},animateOnShow:!1,children:J||!a?m(d,{children:v&&m(w,{color:u,type:h,children:m(P,{children:v})})}):m($,{timeInTransit:a,paragraphColor:u})}),m(Q,{animateOnShow:C.current,show:x.value,from:{opacity:0,transform:"translateX(-10px)"},to:{opacity:1,transform:"translateX(0)"},children:m("div",{className:N&&j[N],children:m(f,{direction:"inline",gap:"small-300",alignItems:"center",children:[m(T,{display:"@media (inline-size >= small) auto, none",children:y&&m(w,{color:u,type:h,children:y})}),m(T,{display:"@media (inline-size >= small) none, auto",children:g&&m(w,{color:u,type:h,children:g})}),F&&t?.brandedPromise&&m(z,{brandedPromise:t.brandedPromise,useCompactLogo:"small"===h})]})})})]}),R&&!s?m(w,{color:u,type:h,children:m("bdi",{children:R})}):null]})):null}var ne=(e,n)=>"shop_promise"===n?e===A.Light?"Branded":void 0:"Unbranded";function te({includeLoadingTelemetry:e=!0}={}){const{shop:{asyncDeliveryPromiseExperienceEnabled:n},observability:o,checkout:{negotiator:a}}=D(),{value:s}=a.current.fields.deliveryExpectations,c=r(()=>a.current.fields.deliveryExpectations.value?.status),d=M("deliveryExpectations"),u=r(()=>a.current.fields.deliveryNext.value?.status),m=M("deliveryNext"),h=l(e),p=i();return t(()=>{const e=c.value,n=u.value;if(!h.value)return void(p.current=void 0);const t=d.value;if(m.value,!t&&"filled"===n&&"filled"===e&&p.current&&(p.current(),p.current=void 0),"filled"===n&&t){const e=performance.now();p.current=()=>{const n=performance.now()-e;o.histogram({name:"delivery_expectations_loading_duration",value:n})}}}),{deliveryExpectationLines:(()=>{const e=s?.deliveryExpectationLines?.some(({brandedPromise:e})=>e?.handle===E.BuyWithPrime);if("filled"===s?.status&&(n||e))return s?.deliveryExpectationLines})(),deliveryExpectationLinesLoading:void 0===s,status:s?.status}}function ie({deliveryExpectationLine:e,deliveryMethod:n,formatContent:t=e=>e,size:a}){const{observability:l,checkout:c}=D(),u=r(()=>function({identity:e}){return"shopPay"===e.current.value}(c)),{deliveryPromiseTitle:h,deliveryPromiseTitleShort:y,deliveryPromisePlaceholderTitle:v,deliveryPromisePlaceholderTitleShort:g}=B(n,e),{deliveryExpectationLinesLoading:_}=te(),P=s(()=>h||y?{long:h,short:y,fallback:!1}:v||g?{long:v,short:g,fallback:!0}:{long:"",short:"",fallback:!1},[v,g,h,y]),x=i(_);return o(()=>{x.current&&!_&&"buy_with_prime"===n.brandedPromise?.handle&&P.fallback&&(l.log("synch_branding_delivery_content_fallback_promise_shown","Fallback delivery promise shown",{is_shop_pay:u.value}),l.counter({name:"membership_fallback_delivery_promise_text_shown",value:1,attributes:{is_shop_pay:u.value}}))},[_,n.brandedPromise?.handle,x,u,l,P.fallback]),t(m(f,{direction:"inline",gap:"none small-400",alignItems:"center",children:[_?m(p,{inlineSize:"small"}):m(d,{children:[m(b,{below:"small",children:m(w,{type:a,children:P.long})}),m(b,{above:"extraSmall",children:m(w,{type:a,children:P.short})})]}),n.brandedPromise&&m(z,{brandedPromise:n.brandedPromise,useCompactLogo:"small"===a})]}))}function re(e){const{checkout:{deliveryPredictions:n}}=D(),{deliveryMethod:t,deliveryExpectationLine:r}=e,o=i(!1),a=t.brandedPromise?.handle??r?.brandedPromise?.handle;if((a?K.get(a):q.Async)===q.Sync)return m(ie,{...e});{const i=m(ee,{...e,estimateCounted:o});return n.current.value?.presents(t)?m(y,{...e,estimateCounted:o,fallback:i}):i}}function oe({methodTitle:e,price:n,showInterpunct:t=!1}){const i=m("bdi",{children:e});return m(ae,t&&n?{children:[i,"·",n]}:{children:i})}function ae({children:e}){const n=u.toArray(e).flatMap((e,n,t)=>n