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