1import"./scripts-97a1c5b8.js";import"./preload-helper-f61836a9.js";const te=(o,f)=>{function I(a){const s=a.split("?")[1];return s?s.split("&").reduce((b,p)=>{const[A,g]=p.split("=");return b[A]=g?decodeURIComponent(g.replace(/\+/g," ")):"",b},{}):{}}const P=I(o),j=I(f),M=Object.keys(P).filter(a=>a=="page"||a=="category").reduce((a,s)=>(a[s]=P[s],a),{}),l=Object.keys(j).filter(a=>a!=="page"&&a!=="category").reduce((a,s)=>(a[s]=j[s],a),{}),u={...M,...l};return`${o.split("?")[0]}?${new URLSearchParams(u).toString()}`},ie=()=>{const o=(r,t)=>{const i=new URL(window.location.href);t!==""?i.searchParams.set(r,t):i.searchParams.delete(r),window.history.replaceState({},"",i.toString())},f=r=>new URLSearchParams(window.location.search).getAll(r),I=()=>{const r=document.querySelector(".js-pagination-next");if(r){const c=new URL(window.location.href),h=new URL(r.href).searchParams.get("page");h&&c.searchParams.set("page",h),r.href=c.toString()}const t=document.querySelector(".js-pagination-prev");if(t){const c=new URL(window.location.href),h=new URL(t.href).searchParams.get("page");h&&c.searchParams.set("page",h),t.href=c.toString()}document.querySelectorAll(".js-pagination-value").forEach(c=>{const v=new URL(window.location.href),T=new URL(c.href).searchParams.get("page");T&&v.searchParams.set("page",T),c.href=v.toString()})},P=document.querySelectorAll(".js-list-categories"),j=document.querySelectorAll(".js-products-filter-checkbox"),M=document.querySelectorAll(".js-products-filter-price"),l=document.getElementById("rangeSliderPrice"),u=document.getElementById("filterPriceFrom"),a=document.getElementById("filterPriceTo"),s=document.getElementById("js-mobile-filters-count"),b=document.querySelectorAll(".js-remove-filter"),p=document.querySelector(".js-pagination-page"),A=document.querySelector(".js-pagination-max-page"),g=document.querySelector(".js-pagination-per-page"),y=document.querySelector(".js-pagination-max-items"),S=document.querySelector(".js-pagination-sort"),F=document.querySelector(".js-pagination-per-page-select"),E=document.querySelector(".js-pagination-load-more"),x=document.querySelector(".js-pagination-result-container"),R=x==null?void 0:x.getAttribute("data-url"),q=document.querySelector(".js-pagination-span-current"),U=document.querySelector(".js-pagination-span-total"),O=document.querySelector(".js-products-pagination-container"),$=document.querySelector(".js-products-sort-results"),D=document.getElementById("js-products-active-filters-count"),w=document.querySelectorAll(".js-filters-clear-all"),k=document.querySelectorAll(".js-filters-clear-all span"),Z=()=>{E&&y&&q&&(y.value.toString()===q.innerHTML?E.style.display="none":E.style.display="flex")},H=()=>{w.forEach(r=>{r.style.display="none"}),b.forEach(r=>{(r.style.display==="flex"||r.style.display==="")&&w.forEach(t=>{t.style.display="flex"})})},N=r=>{const t=document.getElementById(`sidebar-category-counter-${r.id}`);t&&(t.innerHTML=r.count)};let Q;const J=(r,t,i)=>{l.max=r,a&&(u.value=t,a.value=i,l.value1=t,l.value2=i)},d=(r=!1)=>{clearTimeout(Q),Q=setTimeout(()=>{if(!R||!p||!g)return;const t={};t.page=parseInt(p.value,10),t.perPage=parseInt(g.value,10),S&&(t.sort=S.value);const i=f("category");if(i[0]){const[e]=i;t.category=e}const c=f("available");if(c[0]){const[e]=c;e==="true"&&(t.available=!0)}const v=f("notAvailable");if(v[0]){const[e]=v;e==="true"&&(t.notAvailable=!0)}const h=f("promotion");if(h[0]){const[e]=h;e==="true"&&(t.promotion=!0)}const T=f("new");if(T[0]){const[e]=T;e==="true"&&(t.new=!0)}const G=f("bestseller");if(G[0]){const[e]=G;e==="true"&&(t.bestseller=!0)}const K=f("subscription");if(K[0]){const[e]=K;e==="true"&&(t.subscription=!0)}const W=f("priceFrom"),X=f("priceTo");if(W[0]&&X[0]){const[e]=W;t.priceFrom=parseInt(e,10);const[B]=X;t.priceTo=parseInt(B,10)}r&&(t.page=1),fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>{if(e.ok)return e.json();throw new Error("An error occurred.")}).then(e=>{var B,Y;if(k.length>0&&e.activeFilters>0&&k.forEach(n=>{n.innerHTML=`(${e.activeFilters})`}),H(),x&&e.html!==void 0&&(x.innerHTML=e.html),p.value=e.page,o("page",e.page),A&&e.maxPage&&(A.value=e.maxPage),g&&e.perPage&&(g.value=e.perPage),y&&e.maxItems&&(y.value=e.maxItems),q&&y&&(q.innerHTML=Math.min(parseInt(p.value,10)*parseInt(g.value,10),parseInt(y.value,10)).toString()),U&&y&&(U.innerHTML=y.value),O&&(O.innerHTML=e==null?void 0:e.htmlPagination,I()),$&&($.innerHTML=e==null?void 0:e.htmlMaxItems),s&&(s.innerHTML=e==null?void 0:e.htmlMaxItems),(Y=(B=e==null?void 0:e.filters)==null?void 0:B.list_filter_max_price_general)!=null&&Y.value&&a&&a.setAttribute("data-max-value",e.filters.list_filter_max_price_general.value),e!=null&&e.filters&&(Object.keys(e.filters).forEac
1h(n=>{const m=e.filters[n],L=document.getElementById(n),_=L==null?void 0:L.getAttribute("data-trans"),C=document.querySelector(`label[for=${n}]`);_&&Number.isInteger(m==null?void 0:m.count)&&C&&(C.textContent=_.replace("%count%",m.count))}),document.querySelectorAll(".category-page__filters-category-item").forEach(n=>{if(n.tagName==="A"){const m=n;m.href=te(m.href,window.location.href)}})),(e==null?void 0:e.sidebarCategories)!==void 0&&Object.keys(e.sidebarCategories).forEach(n=>{const m=e.sidebarCategories[n],L=document.getElementById(`sidebar-category-counter-${m.id}`);L&&(L.innerHTML=m.count),Object.keys(m.children).forEach(_=>{N(e.sidebarCategories[n].children[_]),Object.keys(e.sidebarCategories[n].children[_].children).forEach(C=>{N(e.sidebarCategories[n].children[_].children[C])})})}),(e==null?void 0:e.sidebarMaxCount)!==void 0){const n=document.getElementById("sidebar-category-counter-all");n&&(n.innerHTML=e.sidebarMaxCount)}if(D&&Number.isInteger(e==null?void 0:e.activeFilters)){const n=D.getAttribute("data-trans");n&&(D.innerText=n.replace("%count%",e.activeFilters))}Z(),J(e.filters.list_filter_max_price_general.value,e.filters.list_filter_min_price.value!==void 0?e.filters.list_filter_min_price.value:0,e.filters.list_filter_max_price.value!==void 0&&e.filters.list_filter_max_price.value<=e.filters.list_filter_max_price_general.value?e.filters.list_filter_max_price.value:e.filters.list_filter_max_price_general.value)}).catch(e=>{console.error(e)})},200)},ee=()=>{if(!l)return;l.sliderBg="#DADADA",l.sliderBgHover="#DADADA",l.sliderBgFill="#21260D",l.pointer1Bg="#21260D",l.pointer2Bg="#21260D",l.pointer1BgHover="#21260D",l.pointer2BgHover="#21260D",l.pointer1BgFocus="#21260D",l.pointer2BgFocus="#21260D",l.pointer1Border="none",l.pointer2Border="none";let r;l.addEventListener("change",t=>{clearTimeout(r),r=setTimeout(()=>{if(u.value===t.detail.value1.toString()&&a.value===t.detail.value2.toString())return;u.value=Math.round(t.detail.value1).toString(),a.value=Math.round(t.detail.value2).toString();const i=a.getAttribute("data-max-value");i&&(a.value=Math.min(parseInt(i,10),Math.round(t.detail.value2)).toString());const c=document.querySelector('button[data-target="list_filter_price"]');if(u&&a){o("priceFrom",u.value),o("priceTo",a.value);const v=c.getAttribute("data-trans");v&&(c.innerHTML=v.replace("%priceFrom%",u.value).replace("%priceTo%",a.value),c.style.display="flex")}d(!0)},200)}),u.addEventListener("change",()=>{l.value1=u.value}),u.addEventListener("change",()=>{l.value2=a.value})};S&&S.addEventListener("change",()=>{o("sort",S.value),S.classList.contains("js-pagination-reset-page-on-change")?d(!0):d()}),F&&g&&F.addEventListener("change",()=>{F.classList.contains("js-pagination-reset-page-on-change")?(g.value=F.value,o("perPage",g.value),d(!0)):d()}),E&&E.addEventListener("click",r=>{r.preventDefault(),p&&(p.value=(parseInt(p.value,10)+1).toString()),d()});const V=r=>{P.forEach(t=>{t.classList.remove("active"),t.getAttribute("data-id")===r&&t.classList.add("active")})};P.forEach(r=>{r.addEventListener("click",t=>{t.preventDefault();const i=r.getAttribute("data-id");!i||i==="all"?(o("category",""),i==="all"&&V(i)):(o("category",i),V(i)),d(!0)})}),j.forEach(r=>{r.addEventListener("click",()=>{const t=document.querySelector(`button[data-target="${r.id}"]`);r.checked?(o(r.name,"true"),t.style.display="flex"):(o(r.name,""),t.style.display="none"),d(!0)})}),M.forEach(r=>{r.addEventListener("change",()=>{const t=document.querySelector('button[data-target="list_filter_price"]');if(u&&a){o("priceFrom",u.value),o("priceTo",a.value);const i=t.getAttribute("data-trans");i&&(t.innerHTML=i.replace("%priceFrom%",u.value).replace("%priceTo%",a.value),t.style.display="flex")}d(!0)})});const z=(r,t=!0)=>{const i=r.getAttribute("data-target");if(i){if(i==="list_filter_price")l.value1=0,l.value2=l.max,o("priceFrom",""),o("priceTo",""),r.style.display="none";else{const c=document.getElementById(i);c&&(c.checked=!1,o(c.name,""),r.style.display="none")}H(),t&&d(!0)}};b.forEach(r=>{r.addEventListener("click",()=>{z(r),d(!0)})}
1),w.forEach(r=>{r.addEventListener("click",()=>{b.forEach(t=>{z(t)}),d(!0)}),w.forEach(t=>{t.style.display="none"})}),H(),ee()};export{ie as shopProductsList};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.