1(()=>{"use strict";function throttle(callback,interval){let enableCall=!0,calledWhenDisabled=!1;return(...args)=>{const onTimeout=()=>{calledWhenDisabled?(callback.apply(this,args),setTimeout(onTimeout,interval)):enableCall=!0,calledWhenDisabled=!1};if(!enableCall){calledWhenDisabled=!0;return}enableCall=!1,callback.apply(this,args),setTimeout(onTimeout,interval)}}function formatMoney(cents,format){var moneyFormat=format||"${{amount}}";typeof cents=="string"&&(cents=cents.replace(".",""));var value="",placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,formatString=moneyFormat;function formatWithDelimiters(number,precision,thousands,decimal){if(precision==null&&(precision=2),thousands=thousands||",",decimal=decimal||".",isNaN(number)||number==null)return"0";number=(number/100).toFixed(precision);var parts=number.split("."),dollarsAmount=parts[0].replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+thousands),centsAmount=parts[1]?decimal+parts[1]:"";return dollarsAmount+centsAmount}var match=formatString.match(placeholderRegex);if(!match)throw new Error(`Invalid format string: '${formatString}'. Expected '{{amount}}' or similar placeholders.`);switch(match[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_with_space_separator":value=formatWithDelimiters(cents,2," ",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break;case"amount_no_decimals_with_space_separator":value=formatWithDelimiters(cents,0," ");break;default:throw new Error(`Unknown format type: ${match[1]}`)}return formatString.replace(placeholderRegex,value)}class FocusTrap{constructor(container,initialElement=null,onEscape=null){this.container=container,this.initialElement=initialElement,this.onEscape=onEscape,this.focusableElements=[],this.firstElement=null,this.lastElement=null,this.handleKeyDown=this.handleKeyDown.bind(this),this.updateFocusableElements=this.updateFocusableElements.bind(this),this.observer=new MutationObserver(this.updateFocusableElements),this.init()}init(){this.container&&(this.container.removeAttribute("inert"),this.updateFocusableElements(),this.initialElement&&this.isFocusable(this.initialElement)?this.initialElement.focus():this.firstElement&&this.firstElement.focus(),this.container.addEventListener("keydown",this.handleKeyDown),this.observer.observe(this.container,{childList:!0,subtree:!0,attributes:!0}))}isFocusable(el){return el?el.offsetParent!==null&&el.getAttribute("tabindex")!=="-1"&&!this.isInsideClosedDetails(el):!1}isInsideClosedDetails(el){let parent=el.parentElement;for(;parent;){if(parent.tagName.toLowerCase()==="details"&&!parent.hasAttribute("open"))return!(el.tagName.toLowerCase()==="summary"&&parent.querySelector("summary")===el);parent=parent.parentElement}return!1}updateFocusableElements(){this.focusableElements=Array.from(this.container.querySelectorAll('a[href], area[href], input:not([type=hidden]), select, textarea, button:not([disabled]), iframe, object, embed, [tabindex]:not([tabindex="-1"]), [contenteditable], summary')).filter(el=>this.isFocusable(el)),this.focusableElements.length>0?(this.firstElement=this.focusableElements[0],this.lastElement=this.focusableElements[this.focusableElements.length-1]):(this.firstElement=null,this.lastElement=null,console.warn("No focusable elements found within the container."))}handleKeyDown(e){if(e.key==="Tab"){if(this.focusableElements.length===0){e.preventDefault();return}e.shiftKey?document.activeElement===this.firstElement&&(e.preventDefault(),this.lastElement.focus()):document.activeElement===this.lastElement&&(e.preventDefault(),this.firstElement.focus())}else e.key==="Escape"&&this.onEscape&&this.onEscape()}destroy(){this.container.setAttribute("inert",""),this.container.removeEventListener("keydown",this.handleKeyDown),this.observer.disconnect()}}class CartManager{constructor(){this.cartType=document.getElementById("PageContainer")?.dataset.cartType,this.cartAction=document.getElementById("PageContainer")?.dataset.cartAction,this.languageUrl=document.getElementById("PageContainer")?.dataset.languageUrl,this.cartCountIndicator=document.querySelector("[data-cart-count-indicator]"),this.wethemeGlobal=document.querySelector("script#wetheme-global"),this.translations=this.wethemeGlobal?JSON.parse(this.wethemeGlobal.textContent).translations:{}}async addSingleProduct(formOrData,button,options={}){let variantId,quantity=1;if(formOrData instanceof HTMLFormElement){const formData=new FormData(formOrData);variantId=formData.get("id"),quantity=parseInt(formData.get("quantity")||"1",10)}else formOrData instanceof FormData?(variantId=formOrData.get("id"),quantity=parseInt(formOrData.get("quantity")||"1",10)):typeof formOrData=="object"&&(variantId=formOrData.id||formOrData.variantId,quantity=formOrData.quantity||1);if(!variantId)throw new Error("No variant ID provided");const items=[{id:parseInt(variantId,10),quantity}];return this.addItemsToCart(items,button,options)}async addMultipleProducts(items,button,options={}){if(!Array.isArray(items)||items.length===0)throw new Error("No items provided or invalid items array");return this.addItemsToCart(items,button,options)}async addItemsToCart(items,button,options={}){button&&this.showLoadingState(button);try{const response=await this.performBulkAdd(items);if(response.ok)return await this.handleSuccess(button,response,options),response;if(response.status===422){console.warn("Bulk add failed due to inventory constraints, trying individual adds...");const individualResponse=await this.addItemsIndividually(items);return await this.handleSuccess(button,individualResponse,options),individualResponse}else{const errorData=await response.json();throw new Error(errorData.description||"Failed to add items to cart")}}catch(error){console.warn("Bulk add failed, trying individual adds...",error);try{const individualResponse=await this.addItemsIndividually(items);return await this.handleSuccess(button,individualResponse,options),individualResponse}catch(individualError){throw button&&this.hideLoadingState(button),individualError}}}async performBulkAdd(items){const payload={items};this.cartType==="drawer"&&(payload.sections="cart-drawer");const config={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(payload)};return fetch(window.routes.cart_add_url,config)}async addItemsIndividually(items){let lastSuccessfulResponse=null,successfullyAdded=0,skippedItems=0;for(const item of items)try{const payload={items:[item]};this.cartType==="drawer"&&(payload.sections="cart-drawer");const config={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(payload)},response=await fetch(window.routes.cart_add_url,config);if(response.ok)successfullyAdded++,lastSuccessfulResponse=response;else if(response.status===422)skippedItems++,console.warn(`Skipping item ${item.id} due to inventory constraints`);else{const errorData=await response.json();console.error(`Failed to add item ${item.id}:`,errorData.description||"Unknown error"),skippedItems++}}catch(error){console.error(`Error adding item ${item.id}:`,error),skippedItems++}if(successfullyAdded===0)throw new Error("No items could be added to cart");return skippedItems>0&&console.info(`Successfully added ${successfullyAdded} items, skipped ${skippedItems} items due to inventory or other issues`),lastSuccessfulResponse||{ok:!0,status:200}}async handleSuccess(button,response,options={}){if(button&&this.hideLoadingState(button),this.cartType==="drawer"&&response&&response.ok)try{const responseJson=await response.clone().json();this.updateCartDrawer(responseJson)}catch(error){console.warn("Could not parse response for cart drawer update:",error)}window.eventBus&&options.sectionId&&window.eventBus.emit("cart:added",{sectionId:options.sectionId}),button?this.handleCartAction(button):this.updateCartCountIndicator()}updateCartDrawer(responseJson){window.eventBus&&window.eventBus.emit("update:cart:drawer",responseJson)}handleCartAction(button){this.cartType==="drawer"?this.cartAction==="show_added_message"?(this.showAddedMessage(button),this.updateCartCountIndicator()):this.cartAction==="go_to_or_open_cart"&&(window.eventBus&&window.eventBus.emit("open:cart:drawer",{scrollToTop:!0}),this.updateCartCountIndicator()):this.cartAction==="show_added_message"?(this.showAddedMessage(button),this.updateCartCountIndicator()):window.location=window.routes.cart_url}showAddedMessage(button){const addedTranslation=this.translations.added,buttonText=button.querySelector("[data-button-text]"),addedText=button.querySelector("[data-cart-added-text]");if(buttonText&&addedText)buttonText.style.visibility="hidden",addedText.style.display="block",setTimeout(()=>{addedText.style.display="none",buttonText.style.visibility="",button.disabled=!1},2e3);else if(buttonText){buttonText.style.visibility="hidden";const tempAddedText=document.createElement("span");tempAddedText.textContent=addedTranslation,tempAddedText.style.gridColumn="1",tempAddedText.style.gridRow="1",tempAddedText.classList.add("temp-added-text"),button.appendChild(tempAddedText),setTimeout(()=>{buttonText.style.visibility="",tempAddedText.remove(),button.disabled=!1},2e3)}else{const originalHTML=button.dataset.originalText||button.innerHTML,originalContent=button.innerHTML;button.innerHTML="";const hiddenContent=document.createElement("span");hiddenContent.innerHTML=originalContent,hiddenContent.style.visibility="hidden",hiddenContent.style.gridColumn="1",hiddenContent.style.gridRow="1";
1const addedContent=document.createElement("span");addedContent.textContent=addedTranslation,addedContent.style.gridColumn="1",addedContent.style.gridRow="1",addedContent.classList.add("temp-added-text"),button.appendChild(hiddenContent),button.appendChild(addedContent),setTimeout(()=>{button.innerHTML=originalHTML,button.disabled=!1},2e3)}}async updateCartCountIndicator(){if(this.cartCountIndicator)try{const languageParam=!this.languageUrl||this.languageUrl==="/"?"":this.languageUrl,cart=await(await fetch(`${languageParam}/cart?view=compare`)).json();window.wetheme?.updateCartCount&&window.wetheme.updateCartCount(cart)}catch(error){console.error("Error updating cart count:",error)}}showLoadingState(button){button.disabled=!0,button.classList.add("loading");const buttonText=button.querySelector("[data-button-text]"),loadingIcon=button.querySelector("[data-loading-icon]");buttonText&&loadingIcon?(buttonText.style.visibility="hidden",loadingIcon.classList.remove("hidden")):(button.dataset.originalText||(button.dataset.originalText=button.textContent),button.innerHTML='<svg viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg" width="1.6em" height="1.6em" class="spin flex-full"><g clip-path="url(#clip0_3605_47041)"><path d="M12.5 23C6.42487 23 1.5 18.0751 1.5 12C1.5 5.92487 6.42487 1 12.5 1C18.5751 1 23.5 5.92487 23.5 12C23.5 15.1767 22.1534 18.0388 20 20.0468" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></g><defs><clipPath id="clip0_3605_47041"><rect width="24" height="24" fill="none" transform="translate(0.5)"/></clipPath></defs></svg>')}hideLoadingState(button){button.disabled=!1,button.classList.remove("loading");const buttonText=button.querySelector("[data-button-text]"),loadingIcon=button.querySelector("[data-loading-icon]");buttonText&&loadingIcon?(buttonText.style.visibility="",loadingIcon.classList.add("hidden")):button.dataset.originalText&&(button.innerHTML=button.dataset.originalText)}}class CollectionFiltersForm extends HTMLElement{handleSortByChangeBound=this.handleSortByChange.bind(this);stopInputPropagationBound=this.stopInputPropagation.bind(this);constructor(){super(),this.filterData=[],this.onActiveFilterClick=this.onActiveFilterClick.bind(this),this.productGridId="CollectionProductGrid",this.filterFormsId="CollectionFiltersForm",this.searchTemplate=document.querySelector("body.template-search"),this.collectionTemplate=document.querySelector("body.template-collection"),this.sections=this.getSections(),this.buttonAriaLabel=this.getAttribute("data-button-aria-label"),this.filterForm=this.querySelector(`#${this.filterFormsId}`),this.sortByDesktop=this.querySelector("#SortBydesktop"),this.sortByMobile=this.querySelector("#SortBymobile"),this.sortByInput=this.querySelector("#sort_by_input"),this.prevWindowWidth=window.innerWidth,this.resizeThreshold=100,window.innerWidth<=991?document.body.classList.contains("js-drawer-open-filter")||this.filterForm.setAttribute("inert",""):this.filterForm.removeAttribute("inert"),this.debouncedOnSubmit=this.debounce(this.onSubmitHandler.bind(this),800),this.handleResize=this.handleResize.bind(this),this.handleCollectionFilterApply=this.handleCollectionFilterApply.bind(this),this.sortByDesktop&&this.sortByMobile&&(this.sortByDesktop.addEventListener("change",this.handleSortByChangeBound),this.sortByMobile.addEventListener("change",this.handleSortByChangeBound),this.sortByDesktop.addEventListener("input",this.stopInputPropagationBound),this.sortByMobile.addEventListener("input",this.stopInputPropagationBound)),this.querySelector("form").addEventListener("input",this.debouncedOnSubmit),document.querySelector("[data-drawer-open-btn]").addEventListener("click",this.handleDrawerOpen.bind(this)),document.querySelector("[data-drawer-close-btn]").addEventListener("click",this.handleDrawerClose.bind(this));const drawerOverlay=document.querySelector("[data-filtering-drawer-overlay]");drawerOverlay&&drawerOverlay.addEventListener("click",this.handleDrawerClose.bind(this)),window.addEventListener("resize",this.handleResize),window.addEventListener("popstate",this.onHistoryChange.bind(this)),window.eventBus&&window.eventBus.on("collection:filter:apply",this.handleCollectionFilterApply),this.bindActiveFacetButtonEvents(),this.onDropDownBlur()}debounce=(fn,wait)=>{let timeout;return(...args)=>{clearTimeout(timeout),timeout=setTimeout(()=>fn(...args),wait)}};stopInputPropagation(event){event.stopPropagation()}onDropDownBlur(){document.addEventListener("click",function(event){document.querySelectorAll("details[open]").forEach(item=>{item.contains(event.target)||item.removeAttribute("open")})})}isHidden(el){return el.offsetParent===null}handleResize(){const currentWidth=window.innerWidth,widthDiff=Math.abs(currentWidth-this.prevWindowWidth),crossedBreakpoint=this.prevWindowWidth<=991&¤tWidth>991||this.prevWindowWidth>991&¤tWidth<=991;if(widthDiff>this.resizeThreshold||crossedBreakpoint){this.prevWindowWidth=currentWidth;const filterDrawer=document.querySelector("collection-filtering-form");if(!filterDrawer)return;filterDrawer.removeAttribute("role"),filterDrawer.removeAttribute("aria-modal"),filterDrawer.removeAttribute("aria-label"),currentWidth<=991?(document.body.classList.contains("js-drawer-open-filter")||this.filterForm.setAttribute("inert",""),filterDrawer.setAttribute("role","dialog"),filterDrawer.setAttribute("aria-modal","true"),filterDrawer.setAttribute("aria-label",this.buttonAriaLabel)):this.filterForm.removeAttribute("inert")}}handleCollectionFilterApply(event){!event||!event.filterParams||this.renderPage(event.filterParams,null,!0)}handleDrawerOpen(){const filterDrawer=this.querySelector("#CollectionFiltersForm");window.innerWidth<=991&&this.filterForm&&this.filterForm.removeAttribute("inert"),document.body.classList.add("js-drawer-open-filter","js-drawer-open"),this.focusTrap=new FocusTrap(filterDrawer,null,this.handleDrawerClose.bind(this))}handleDrawerClose(){const filterBtn=document.querySelector("[data-drawer-open-btn]");document.body.classList.remove("js-drawer-open-filter","js-drawer-open"),window.innerWidth<=991&&this.filterForm&&this.filterForm.setAttribute("inert",""),filterBtn.setAttribute("tabIndex","0"),filterBtn.focus(),this.focusTrap&&(this.focusTrap.destroy(),this.focusTrap=null)}handleSortByChange(event){event.preventDefault(),event.stopPropagation();const newValue=event.target.value;if(!this.sortByInput){console.warn("Sort by input element not found");return}this.sortByInput.value=newValue,event.target===this.sortByDesktop?this.sortByMobile.value!==newValue&&(this.sortByMobile.value=newValue):event.target===this.sortByMobile&&this.sortByDesktop.value!==newValue&&(this.sortByDesktop.value=newValue),this.sortByInput.dispatchEvent(new Event("input",{bubbles:!0}))}onSubmitHandler(event){event.preventDefault();const processForm=(formData,uniqueFormData)=>{let priceGte=null,priceLte=null;event.target&&event.target.matches("input[data-price-range-min]")?priceGte=event.target.value:event.target&&event.target.matches("input[data-price-range-max]")&&(priceLte=event.target.value);const paramMap=new Map;for(const[key,value]of formData.entries())value!==""&&(paramMap.has(key)||paramMap.set(key,new Set),paramMap.get(key).add(value));event.target?.type==="checkbox"&&!event.target.checked&¶mMap.has(event.target.name)&&(paramMap.get(event.target.name).delete(event.target.value),paramMap.get(event.target.name).size===0&¶mMap.delete(event.target.name)),priceGte!==null&&(paramMap.set("filter.v.price.gte",new Set([priceGte])),this.filterForm.querySelectorAll("input[data-price-range-min]").forEach(input=>input.value=priceGte)),priceLte!==null&&(paramMap.set("filter.v.price.lte",new Set([priceLte])),this.filterForm.querySelectorAll("input[data-price-range-max]").forEach(input=>input.value=priceLte));for(const[key,values]of paramMap.entries())uniqueFormData.delete(key),values.forEac
1h(value=>{uniqueFormData.append(key,value)})};if(this.collectionTemplate){const formData=new FormData(this.filterForm),uniqueFormData=new URLSearchParams;processForm(formData,uniqueFormData);const searchParams=uniqueFormData.toString();this.renderPage(searchParams,event)}else if(this.searchTemplate){const searchParamsInitial=new URLSearchParams(window.location.search),activeTypes=document.querySelector("#page-type-input").value,types=Array.from(activeTypes.split(",")),defaultTypes=document.querySelector('.search--header input[name="type"]');if(activeTypes===""){const getInput=document.querySelector("#page-type-input");getInput.value=defaultTypes.value}const formData=new FormData(this.filterForm),uniqueFormData=new URLSearchParams;if(processForm(formData,uniqueFormData),uniqueFormData.append("q",searchParamsInitial.get("q")),types.includes("article")&&!types.includes("product")||types.includes("page")&&!types.includes("product")){const getInputs=document.querySelectorAll(`#${this.filterFormsId} input:not(#page-type-input)`),getLabels=document.querySelectorAll(`#${this.filterFormsId} label:not(.collection-filters__label)`);for(let item of getInputs)item.setAttribute("disabled","disabled");for(let inputLabel of getLabels)inputLabel.classList.add("facet-checkbox--disabled");searchParamsInitial.has("filter.p.product_type")&&uniqueFormData.delete("filter.p.product_type"),searchParamsInitial.has("filter.p.vendor")&&uniqueFormData.delete("filter.p.vendor"),searchParamsInitial.has("filter.v.availability")&&uniqueFormData.delete("filter.v.availability"),searchParamsInitial.has("filter.v.price.gte")&&uniqueFormData.delete("filter.v.price.gte"),searchParamsInitial.has("filter.v.price.lte")&&uniqueFormData.delete("filter.v.price.lte")}else{const getInputs=document.querySelectorAll(`#${this.filterFormsId} input:not(#page-type-input)`),getLabels=document.querySelectorAll(`#${this.filterFormsId} label:not(.collection-filters__label)`);for(let item of getInputs)item.removeAttribute("disabled");for(let inputLabel of getLabels)inputLabel.classList.remove("facet-checkbox--disabled")}const searchParams=uniqueFormData.toString();this.renderPage(searchParams,event)}}onActiveFilterClick(event){event.preventDefault(),event.currentTarget.setAttribute("loading","true"),this.toggleActiveFacets(),(event.currentTarget.classList.contains("price-filter-reset")||event.currentTarget.classList.contains("js-clear-all-filters"))&&(this.filterForm.querySelectorAll("input[data-price-range-min]").forEach(input=>input.value=""),this.filterForm.querySelectorAll("input[data-price-range-max]").forEach(input=>input.value="")),this.renderPage(new URL(event.currentTarget.href).searchParams.toString(),event)}onHistoryChange(event){const searchParams=event.state?.searchParams||"";this.renderPage(searchParams,null,!1)}toggleActiveFacets(disable=!0){document.querySelectorAll(".js-facet-remove").forEach(element=>{element.classList.toggle("disabled",disable)})}renderPage(searchParams,event,updateURLHash=!0){document.querySelector(`#${this.productGridId}>div`).classList.add("loading"),this.sections.forEach(section=>{if(this.collectionTemplate){const url=`${window.location.pathname}?section_id=${section.section}&${searchParams}`,filterDataUrl=element=>element.url===url;this.filterData.some(filterDataUrl)?this.renderSectionFromCache(filterDataUrl,section,event):this.renderSectionFromFetch(url,section,event)}else if(this.searchTemplate){const url=`${window.location.pathname}?${searchParams}`,filterDataUrl=element=>element.url===url;this.filterData.some(filterDataUrl)?this.renderSectionFromCache(filterDataUrl,section,event):this.renderSectionFromFetch(url,section,event)}}),updateURLHash&&this.updateURLHash(searchParams),window.eventBus.emit("collection:filters:change",{details:{parameters:searchParams}})}renderSectionFromFetch(url,section,event){fetch(url).then(response=>response.text()).then(responseText=>{const html=responseText;switch(this.filterData=[...this.filterData,{html,url}],section.id){case this.productGridId:this.renderProductGrid(html);break;case this.filterFormsId:this.renderFilters(html,event);break;case"CollectionGridBanner":this.renderCollectionGridBanner(html);break;default:return}})}
1renderSectionFromCache(filterDataUrl,section,event){const cachedData=this.filterData.find(filterDataUrl);if(!cachedData)return;const html=cachedData.html;switch(section.id){case this.productGridId:this.renderProductGrid(html);break;case this.filterFormsId:this.renderFilters(html,event);break;case"CollectionGridBanner":this.renderCollectionGridBanner(html);break;default:return}}renderCollectionGridBanner(html){const newBannerElement=new DOMParser().parseFromString(html,"text/html").querySelector("collection-grid-banner"),currentBannerElement=document.querySelector("collection-grid-banner");if(newBannerElement&¤tBannerElement){const currentItems=currentBannerElement.querySelectorAll(".collection-grid-banner__item-image"),newItems=newBannerElement.querySelectorAll(".collection-grid-banner__item-image");currentItems.forEach((currentItem,index)=>{newItems[index]&¤tItem.replaceWith(newItems[index])});const bannerComponent=currentBannerElement;bannerComponent&&typeof bannerComponent.attachEventListeners=="function"&&bannerComponent.attachEventListeners()}}renderProductGrid(html){const parsed=new DOMParser().parseFromString(html,"text/html"),newGrid=parsed.querySelector("[data-product-grid-inner]"),currentGrid=document.querySelector("[data-product-grid-inner]");if(newGrid&¤tGrid)currentGrid.innerHTML=newGrid.innerHTML;else{const innerHTML=parsed.getElementById(this.productGridId).innerHTML;document.getElementById(this.productGridId).innerHTML=innerHTML}window.dispatchEvent(new Event("scroll"));const event=new CustomEvent("paginate");document.dispatchEvent(event)}renderFilters(html){new DOMParser().parseFromString(html,"text/html").querySelectorAll("[data-filter-update]").forEach(newElement=>{const targetElement=document.querySelector(`[data-filter-update="${newElement.getAttribute("data-filter-update")}"]`);targetElement&&(targetElement.innerHTML=newElement.innerHTML)}),this.bindSortByEventListeners(),this.bindActiveFacetButtonEvents()}bindSortByEventListeners(){this.sortByDesktop=this.querySelector("#SortBydesktop"),this.sortByMobile=this.querySelector("#SortBymobile"),this.sortByDesktop&&this.sortByMobile&&(this.sortByDesktop.removeEventListener("change",this.handleSortByChangeBound),this.sortByMobile.removeEventListener("change",this.handleSortByChangeBound),this.sortByDesktop.removeEventListener("input",this.stopInputPropagationBound),this.sortByMobile.removeEventListener("input",this.stopInputPropagationBound),this.sortByDesktop.addEventListener("change",this.handleSortByChangeBound),this.sortByMobile.addEventListener("change",this.handleSortByChangeBound),this.sortByDesktop.addEventListener("input",this.stopInputPropagationBound),this.sortByMobile.addEventListener("input",this.stopInputPropagationBound))}bindActiveFacetButtonEvents(){document.querySelectorAll(".js-facet-remove").forEach(element=>{element.removeEventListener("click",this.onActiveFilterClick),element.addEventListener("click",this.onActiveFilterClick,{once:!0})})}updateURLHash(searchParams){history.pushState({searchParams},"",`${window.location.pathname}${searchParams?"?".concat(searchParams):""}`)}getSections(){const sections=[{id:this.productGridId,section:document.getElementById(this.productGridId).dataset.sectionId},{id:this.filterFormsId,section:document.getElementById("main-collection-filters").dataset.id}],collectionGridBanner=document.querySelector("collection-grid-banner");return collectionGridBanner&§ions.push({id:"CollectionGridBanner",section:collectionGridBanner.dataset.wethemeSectionId}),sections}disconnectedCallback(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("popstate",this.onHistoryChange.bind(this)),window.eventBus&&window.eventBus.off("collection:filter:apply",this.handleCollectionFilterApply)}}customElements.define("collection-filtering-form",CollectionFiltersForm);class PriceRange extends HTMLElement{constructor(){super(),this.querySelectorAll("input").forEach(element=>{element.addEventListener("change",this.onRangeChange.bind(this)),element.addEventListener("keydown",this.onKeyDown.bind(this))}),this.setMinAndMaxValues()}onRangeChange(event){this.adjustToValidValues(event.currentTarget),this.setMinAndMaxValues()}onKeyDown(event){if(event.metaKey)return;const pattern=/[0-9]|\.|,|'| |Tab|Backspace|Enter|ArrowUp|ArrowDown|ArrowLeft|ArrowRight|Delete|Escape/;event.key.match(pattern)||event.preventDefault()}setMinAndMaxValues(){const inputs=this.querySelectorAll("input"),minInput=inputs[0],maxInput=inputs[1];maxInput.value&&minInput.setAttribute("data-max",maxInput.value),minInput.value&&maxInput.setAttribute("data-min",minInput.value),minInput.value===""&&maxInput.setAttribute("data-min",0),maxInput.value===""&&minInput.setAttribute("data-max",maxInput.getAttribute("data-max"))}adjustToValidValues(input){const value=Number(input.value),min=Number(input.getAttribute("data-min")),max=Number(input.getAttribute("data-max"));value<min&&(input.value=min),value>max&&(input.value=max)}}customElements.define("price-range-selector",PriceRange);class PageType extends HTMLElement{constructor(){super(),this.selector=document.querySelector("[data-page-type-selector]"),this.selector.addEventListener("change",this.setValue)}setValue(e){const selectedTypes=e.currentTarget.querySelectorAll("input:checked"),types=Array.from(selectedTypes).map(option=>
1option.value).join(","),typeInput=document.querySelector("#page-type-input");typeInput.value=types;const event=new Event("input");typeInput.closest("form").dispatchEvent(event)}}customElements.define("page-type-selector",PageType)})(); 2//# sourceMappingURL=/cdn/shop/t/182/assets/component-filtering.js.map?v=9215805537940892161787686531
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.