import{A as g,y as f,u as e}from"./vendor.BXe-L2nx.js";import{b as d,aD as x,T as l,aE as b,as as m,u as T,B as p,aF as P,f as _,aG as y,$ as c,ad as C,aH as S,aI as A}from"./app.aa9qjHTz.js";import{M as v}from"./StackedMerchandisePreview.w4mdCweF.js";function w({deliveryExpectationLine:n,deliveryMethod:i,children:a}){const{telemetryClient:r}=d(),t=g(!1);return f(()=>{if(t.current)return;const s=i.brandedPromise?.handle??n?.brandedPromise?.handle??"unbranded";t.current=!0,r.counter({name:"PostPurchase_page_delivery_prediction_rendered",value:1,attributes:{handle:s}})},[n?.brandedPromise?.handle,i.brandedPromise?.handle,r]),a}function D({deliveryMethod:n,subtitle:i,isInModal:a=!1,choiceListContext:r=!0,useBaseFontSize:t}){const{deliveryExpectationLines:s}=x(),o=s?.find(h=>h.deliveryStrategyHandle===n.handle),u=a||t?void 0:"small";return i?e(l,{size:u,color:"subdued",children:i}):e(w,{deliveryExpectationLine:o,deliveryMethod:n,children:e(b,{deliveryMethod:n,deliveryExpectationLine:o,size:u,choiceListContext:r&&!a})})}function E({merchandiseItem:{title:n,quantity:i},quantityPosition:a}){const{i18n:r}=d();return a==="inline"?e(l,{children:r.translate("shipping.split_shipping_merchandise_quantity_label_inline",{merchandise_title:n,quantity:i??0})}):e(l,{children:n})}function I({merchandiseItem:{subtitle:n,quantity:i},textDefaultProps:a,quantityPosition:r}){const{i18n:t}=d(),s=r==="inlinePrimary";return n||s?e(_,{direction:"inline",gap:"small-400",alignItems:"center",children:[n?e(l,{...a,children:n}):null,n&&s?e(l,{...a,children:P}):null,s?e(l,{...a,children:t.translate("shipping.split_shipping_merchandise_quantity_label_inline_primary",{quantity:i??0})}):null]}):null}function k({merchandiseItem:n,thumbnailSize:i}){const{lineItems:{quantityPosition:a="thumbnailBadge",optionsColor:r="subdued",optionsEmphasis:t}}=T();return e(m,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-200",children:[e(v,{merchandiseItem:n,size:i}),e(p,{blockAlignment:"center",children:[e(E,{merchandiseItem:n,quantityPosition:a}),e(I,{merchandiseItem:n,textDefaultProps:{size:"small",color:r,type:t==="bold"?"strong":void 0},quantityPosition:a})]})]})}function M({merchandise:n,thumbnailSize:i="small",merchandiseItemGap:a="small-200",merchandiseItemPadding:r="none"}){return e(m,{gridAutoRows:"minmax(auto, max-content)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content)",gap:a,padding:r,children:n.map(t=>e(k,{merchandiseItem:t,thumbnailSize:i},t.stableId))})}function z({merchandiseLines:n=[],deliveryMethod:i,modalHeader:a,subtitle:r,choiceListContext:t=!0,showPrice:s,open:o=!1}){return e(y,{heading:a,id:"merchandise-modal",open:o,children:[e(M,{merchandise:n,thumbnailSize:"base",merchandiseItemGap:"base",merchandiseItemPadding:"small-100 none none none"}),e(c,{spacing:"large200"}),e(C,{}),e(c,{}),e(m,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",children:[e(p,{blockAlignment:"start",children:[e(l,{children:S({deliveryMethod:i})}),e(D,{subtitle:r,deliveryMethod:i,choiceListContext:t,isInModal:!0})]}),s?e(A,{cost:i.cost,costAfterDiscounts:i.costAfterDiscounts,styleOverrides:{shouldBold:!t,freeTextLetterCase:"uppercase",costSpacing:"none"}}):null]}),e(c,{spacing:"large200"})]})}export{M as E,z as M,D as S};
