"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[28],{118:(e,t,r)=>{r.d(t,{a:()=>b});var s=r(0),l=r(4),n=r(24),i=r(64),o=r(53),c=r(2),d=r(83),a=r(69);function u(){const e=(0,a.a)((e=>e.filterList)),t=(0,c.useMemo)((()=>function(e){return null==e?void 0:e.some((e=>{var t;return null===(t=e.values)||void 0===t?void 0:t.some((e=>e.selected))}))}(e)),[e]);return(0,s.jsxs)("div",{class:n.a.empty,children:[(0,s.jsx)("h2",{children:"No Results"}),(0,s.jsx)("button",{"data-has-selected-filters":t,onClick:()=>{(0,d.c)(e)},children:"Clear Filters"})]})}var f=r(54),h=r(68);function b({collection:e,mobile_slider:t="disabled",desktop_slider:r="disabled",device:d}){var a;(0,i.d)(e),(0,h.b)(e.products);const[b,p]=(0,c.useState)(0),v=(0,c.useRef)(null),m=(0,c.useRef)(null),g=()=>{const e=v.current,t=m.current;if(!e||!t)return;const r=e.scrollLeft/(e.scrollWidth-e.clientWidth);t.style.setProperty("--scroll-progress",r.toString())},j=()=>{const e=v.current;if(!e)return;g();const t=e.getBoundingClientRect(),r=Array.from(e.children),s=r[r.length-1].getBoundingClientRect().right-t.right<45;let l=1/0;r.forEach(((e,r)=>{const n=e.getBoundingClientRect();if(s&&n.left<0)return;const i=Math.abs(n.left-t.left)+(n.left<0?20:0);iC?x.flatMap(((e,t)=>{const r=C.find((e=>e.position===t+1));return r?[r,e]:e})):x),[x,C]));var x,C;return(0,c.useEffect)((()=>{const e=v.current;if(e)return e.addEventListener("scroll",j),g(),()=>{e.removeEventListener("scroll",j)}}),[v.current]),0===k.length?(0,s.jsx)(u,{}):(t=function(e,t){return 1===e||"1.5"===t?"1.5":2===e?"disabled":t}(k.length,t),(0,s.jsxs)(l.Fragment,{children:[(0,s.jsxs)("div",{class:n.a.container,ref:m,children:["disabled"!==r&&"desktop"===d?(0,s.jsx)(f.a,{direction:"left",onClick:()=>{const e=v.current;if(!e)return;const t=.8*e.offsetWidth;e.scrollBy({left:-t,behavior:"smooth"})},className:n.a.arrowLeft,ariaLabel:"Previous products"}):null,(0,s.jsx)("div",{class:[n.a.collectionItems,"disabled"!==r&&n.a.desktopItemsSlider,"disabled"!==t&&n.a.mobileItemsSlider].join(" "),style:{"--collection-desktop-slider-size":r,"--collection-mobile-slider-size":t},ref:v,"data-slider":"disabled"!==t||"disabled"!==r?"true":void 0,children:k.map(((t,r)=>{if(!t)return null;const l="defaultVariantId"in t?`${t.handle}${t.defaultVariantId}`:`${t.handle}${r}`;return(0,s.jsx)(o.a,{product:t,collectionHandle:e.handle},l)}))}),"disabled"!==r&&"desktop"===d?(0,s.jsx)(f.a,{direction:"right",onClick:()=>{const e=v.current;if(!e)return;const t=.8*e.offsetWidth;e.scrollBy({left:t,behavior:"smooth"})},className:n.a.arrowRight,ariaLabel:"Next products"}):null]}),"disabled"!==t&&k.length>=parseFloat(t)&&(0,s.jsx)("div",{class:n.a.sliderDots,children:e.products.slice(0,["2.0","2.5"].includes(t)?e.products.length-1:e.products.length).map(((e,t)=>(0,s.jsx)("button",{type:"button",class:[n.a.dot,t===b&&n.a.dotActive].join(" "),onClick:()=>(e=>{const t=v.current;if(!t)return;const r=Array.from(t.children)[e];r&&r.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})})(t),"aria-label":`Go to product ${t+1}`},t)))})]}))}}}]);