import{T as e,m as t,w as n,h as i,u as r}from"./2c1ab0fe.Dbn2KvkT.js";import{d as o,bt as a,ax as s,au as l,aw as u}from"./4b4bc88f.z1yoAwwH.js";import{p as c,l as d,a8 as m,k as h,Z as p,Q as f,b as v,c2 as b,M as g,d as y,ap as x,c4 as I}from"./164ad2e3.FTBuhkTQ.js";import{u as S,E as z,a as M}from"./347b440c.Cr4Lo5jt.js";import{M as k}from"./ca0c3e72.CvmHYoux.js";function w({targeted:e,hasMultipleDeliveryGroups:i,shouldHandleRollup:r}){const o=n(c("Checkout::ShippingMethods::RenderBefore")),a=n(c("Checkout::ShippingMethods::RenderAfter")),s=n(i);return t(()=>{const t=e===s.value,n=C(o.value,t,e),i=C(a.value,t,e);return r?t?{customizationsBefore:n,customizationsAfter:i,customizationsForRollupReveal:[...n,...i]}:{customizationsBefore:n,customizationsAfter:i,customizationsForRollupReveal:e?[]:[...P(o.value),...P(a.value)]}:{customizationsBefore:n,customizationsAfter:i}})}function C(e,t,n){return t?n?P(e):e:[]}function P(e){return e.filter(e=>"uiExtension"!==e.kind||function(e){switch(e){case"2023-04":case"2023-07":case"2023-10":return!1;default:return!0}}(e.extension.apiVersion))}function T(){const{checkout:{negotiator:n}}=o(),{deliveryNext:i}=n.current.fields,r=e(void 0);return t(()=>function(e,t){if(Boolean(a(e)))return t.current=void 0,{hasMultipleDeliveryGroups:!0,onlyDeliveryGroupType:void 0};const n=("filled"===e?.status?e.lines:[]).filter(e=>"not_required"!==e.status&&!e.hasNoDeliveryMethods),i=n[0]?.type,r=n.length>1,o=r||!i?void 0:i;return void 0!==o?t.current=o:r&&(t.current=void 0),{hasMultipleDeliveryGroups:r,onlyDeliveryGroupType:o??t.current}}(i.value,r))}const R={showShipmentBreakdown:!1};function G(e){return!(!e||"not_required"===e.status)&&e.methods.some(({methodType:e})=>"LOCAL"===e)}function A(e){return"SHIPPING"!==e?.methodType&&"PICKUP_POINT"!==e?.methodType?[]:e.priceBreakdown??[]}function D(){const{checkout:{negotiator:e}}=o(),n=e.current.fields.deliveryNext,i=d();return t(()=>{const e=n.value;if(!e||"filled"!==e.status)return R;const t=e.splitShippingToggle;if(!t)return R;const r=s(e).filter(e=>l(e)&&!(m(i.value.currentDetour)&&"SUBSCRIPTION"===e.type)),o=r[0];if(G(o))return R;const c=u(o),d=A(c),h=d[0]?.flatRateGroupId;return!a(e)&&h&&d.every(({flatRateGroupId:e})=>e===h)||1===r.length?!c||d.length<=1?R:{showShipmentBreakdown:t,selectedDeliveryMethod:c}:R})}function L(){const{checkout:{negotiator:e}}=o(),n=e.current.fields.deliveryNext;return t(()=>{const e=n.value;return!(!e||"filled"!==e.status)&&(!!e.splitShippingToggle&&e.lines.filter(e=>!G(e)).map(u).filter(e=>void 0!==e).some(e=>A(e).length>1))})}function B({deliveryExpectationLine:t,deliveryMethod:n,children:r}){const{observability:a}=o(),s=e(!1);return i(()=>{if(s.current)return;const e=n.brandedPromise?.handle??t?.brandedPromise?.handle??"unbranded";s.current=!0,a.counter({name:"PostPurchase_page_delivery_prediction_rendered",value:1,attributes:{handle:e}})},[t?.brandedPromise?.handle,n.brandedPromise?.handle,a]),r}function F({deliveryMethod:e,subtitle:t,isInModal:n=!1,choiceListContext:i=!0,useBaseFontSize:o,showSubtitleFallback:a=!0}){const{deliveryExpectationLines:s}=S(),l=s?.find(t=>t.deliveryStrategyHandle===e.handle),u=n||o?void 0:"small";return t?r(h,{size:u,color:"subdued",children:t}):a?r(B,{deliveryExpectationLine:l,deliveryMethod:e,children:r(z,{deliveryMethod:e,deliveryExpectationLine:l,size:u,choiceListContext:i&&!n,paragraphColor:"subdued"})}):null}function E({merchandiseItem:{title:e}}){return r(h,{children:e})}function N({merchandiseItem:{subtitle:e},textDefaultProps:t}){return e?r(h,{...t,children:e}):null}function _({merchandiseItem:e,thumbnailSize:t,thumbnailContentGap:n}){const{lineItems:{optionsColor:i="subdued"}}=f(),o={size:"small",color:i};return r(p,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:n,children:[r(k,{merchandiseItem:e,size:t}),r(v,{blockAlignment:"center",children:[r(E,{merchandiseItem:e}),r(N,{merchandiseItem:e,textDefaultProps:o})]})]})}function j({merchandise:e,thumbnailSize:t="small",merchandiseItemGap:n="small-200",merchandiseItemPadding:i="none",thumbnailContentGap:o="small-200"}){return r(p,{gridAutoRows:"minmax(auto, max-content)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content)",gap:n,padding:i,children:e.map(e=>r(_,{merchandiseItem:e,thumbnailSize:t,thumbnailContentGap:o},e.stableId))})}function H({id:e,merchandiseLines:t=[],deliveryMethod:n,modalHeader:i,subtitle:o,showSubtitleFallback:a,choiceListContext:s=!0,showPrice:l,open:u}){const c=n.included?r(b,{strong:!s}):r(M,{cost:n.cost,costAfterDiscounts:n.costAfterDiscounts,styleOverrides:{shouldBold:!s,freeTextLetterCase:"uppercase",costSpacing:"none"}});return r(g,{heading:i,id:e,open:u,children:[r(j,{merchandise:t,thumbnailSize:"base",merchandiseItemGap:"base",merchandiseItemPadding:"small-100 none none none"}),r(y,{blockSize:"large-200"}),r(x,{}),r(y,{blockSize:"base"}),r(p,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",children:[r(v,{blockAlignment:"start",children:[r(h,{children:I({deliveryMethod:n})}),r(F,{subtitle:o,showSubtitleFallback:a,deliveryMethod:n,choiceListContext:s,isInModal:!0})]}),l?c:null]}),r(y,{blockSize:"large-200"})]})}export{j as E,H as M,F as S,D as a,T as b,L as c,A as g,w as u};