"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[28],{65:function(e,t,l){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Collection=function({collection:e,mobile_slider:t="disabled",desktop_slider:l="disabled"}){(0,d.useLogCollection)(e);const[n,u]=(0,c.useState)(0),a=(0,c.useRef)(null),f=()=>{const e=a.current;if(!e)return;const t=e.getBoundingClientRect(),l=Array.from(e.children),n=l[l.length-1].getBoundingClientRect().right-t.right<45;let r=1/0;l.forEach(((e,l)=>{const s=e.getBoundingClientRect();if(n&&s.left<0)return;const i=Math.abs(s.left-t.left)+(s.left<0?20:0);i{var t;const l=null===(t=e.transformedMetafields)||void 0===t?void 0:t.disruptors;return l?e.products.flatMap(((e,t)=>{const n=l.find((e=>e.position===t+1));return n?[n,e]:e})):e.products}),[e]);return(0,c.useEffect)((()=>{var e;return null===(e=a.current)||void 0===e||e.addEventListener("scroll",f),()=>{var e;null===(e=a.current)||void 0===e||e.removeEventListener("scroll",f)}}),[a.current]),0===h.length?(0,r.jsx)(s.Fragment,{}):(t=function(e,t){return 1===e||"1.5"===t?"1.5":2===e?"disabled":t}(h.length,t),(0,r.jsxs)(s.Fragment,{children:[(0,r.jsx)("div",{class:i.default.container,children:(0,r.jsx)("div",{class:[i.default.collectionItems,"disabled"!==l&&i.default.desktopItemsSlider,"disabled"!==t&&i.default.mobileItemsSlider].join(" "),style:{"--collection-desktop-slider-size":l,"--collection-mobile-slider-size":t},ref:a,children:h.map(((t,l)=>{if(!t)return null;const n="defaultVariantId"in t?`${t.handle}${t.defaultVariantId}`:`${t.handle}${l}`;return(0,r.jsx)(o.ProductCard,{product:t,collectionHandle:e.handle},n)}))})}),"disabled"!==t&&h.length>=parseFloat(t)&&(0,r.jsx)("div",{class:i.default.sliderDots,children:e.products.slice(0,["2.0","2.5"].includes(t)?e.products.length-1:e.products.length).map(((e,t)=>(0,r.jsx)("div",{class:[i.default.dot,t===n&&i.default.dotActive].join(" ")},t)))})]}))};const r=l(0),s=l(3),i=n(l(26)),d=l(49),o=l(47),c=l(2)}}]);