"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[34],{122:(t,e,n)=>{n.d(e,{a:()=>u,b:()=>d});var i=n(0),a=n(2),s=n(80),l=n(7),c=n(35),r=n(143),o=n(25);function u({cart:t,pathname:e,selectedVariant:n,flags:l,cartStatus:u,changeCart:m,config:h,quantityPricingProductIds:g=[]}){const p=d(t),v=(0,c.a)(null==p?void 0:p.currency),b=(0,a.useMemo)((()=>(null==p?void 0:p.items)?(0,r.a)(p.items,g):[]),[null==p?void 0:p.items,g]);return(0,i.jsx)("ul",{"aria-label":"Cart items",children:b.map(((t,a)=>(0,i.jsx)("li",{"aria-label":(0,o.b)(t.product_title,t.options_with_values),children:(0,i.jsx)(s.a,Object.assign({},t,{cartItemkKey:t.key,selectedVariantId:null==n?void 0:n.variantId,pathname:e,line:a+1,flags:l,cartStatus:u,changeCart:m,height:h.product_image_height,width:h.product_image_width,hostname:h.hostname,currency:null==p?void 0:p.currency,formatCurrency:v}))},t.key)))})}function d(t){var e,n;const i=(0,l.i)("orderDiscountLabel");if(!t)return t;const a=null!==(e=t.cart_level_discount_applications)&&void 0!==e?e:[];if(a.length<1||"enabled"!==i())return t;const s=new Set(a.map((t=>t.title)));let c=!1;const r=(null!==(n=t.items)&&void 0!==n?n:[]).map((t=>{var e,n,i;const a=null!==(e=t.discounts)&&void 0!==e?e:[],l=null!==(n=t.discounted_price)&&void 0!==n?n:0;let r=0;const o=a.filter((t=>!((null==t?void 0:t.title)&&s.has(t.title)&&(r+=t.amount,1))));let u=!1;const d=Array.isArray(t.item_components)?t.item_components.map((t=>{var e;const n=null!==(e=t.discounts)&&void 0!==e?e:[],i=n.filter((t=>!((null==t?void 0:t.title)&&s.has(t.title))));return i.length!==n.length?(u=!0,Object.assign(Object.assign({},t),{discounts:i})):t})):t.item_components,m=r>0||o.length!==a.length;if(m||u){c=!0;const e=Math.max(1,null!==(i=t.quantity)&&void 0!==i?i:1),n=l*e,a=Math.round((n+r)/e);return Object.assign(Object.assign(Object.assign({},t),m?{discounted_price:a,discounts:o}:{}),u?{item_components:d}:{})}return t}));return c?Object.assign(Object.assign({},t),{items:r}):t}}}]);