"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[50],{214:(t,e,n)=>{n.d(e,{a:()=>d,b:()=>m});var i=n(0),s=n(1),l=n(142),a=n(6),c=n(23),o=n(166),r=n(11),u=n(129);function d({pathname:t,flags:e,config:n,quantityPricingProductIds:a=[],cartApp:d}){const h=m(d.cart.value),p=(0,c.a)(null==h?void 0:h.currency),g=(0,s.useMemo)((()=>(null==h?void 0:h.items)?(0,o.a)(h.items,a).filter((t=>!(0,u.k)(t))):[]),[null==h?void 0:h.items,a]);return(0,i.jsx)("ul",{"aria-label":"Cart items",children:g.map(((s,a)=>(0,i.jsx)("li",{"aria-label":(0,r.b)(s.product_title,s.options_with_values),children:(0,i.jsx)(l.a,Object.assign({},s,{cartItemkKey:s.key,pathname:t,line:a+1,flags:e,cartApp:d,height:n.product_image_height,width:n.product_image_width,hostname:n.hostname,currency:null==h?void 0:h.currency,formatCurrency:p}))},s.key)))})}function m(t){var e,n;const i=(0,a.l)("orderDiscountLabel");if(!t)return t;const s=null!==(e=t.cart_level_discount_applications)&&void 0!==e?e:[];if(s.length<1||"enabled"!==i())return t;const l=new Set(s.map((t=>t.title)));let c=!1;const o=(null!==(n=t.items)&&void 0!==n?n:[]).map((t=>{var e,n,i;const s=null!==(e=t.discounts)&&void 0!==e?e:[],a=null!==(n=t.discounted_price)&&void 0!==n?n:0;let o=0;const r=s.filter((t=>!((null==t?void 0:t.title)&&l.has(t.title)&&(o+=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)&&l.has(t.title))));return i.length!==n.length?(u=!0,Object.assign(Object.assign({},t),{discounts:i})):t})):t.item_components,m=o>0||r.length!==s.length;if(m||u){c=!0;const e=Math.max(1,null!==(i=t.quantity)&&void 0!==i?i:1),n=a*e,s=Math.round((n+o)/e);return Object.assign(Object.assign(Object.assign({},t),m?{discounted_price:s,discounts:r}:{}),u?{item_components:d}:{})}return t}));return c?Object.assign(Object.assign({},t),{items:o}):t}}}]);