1customElements.get("facet-form")||customElements.define("facet-form",class extends HTMLFormElement{constructor(){super(),this.dirty=!1,this.cachedMap=new Map,this.isMobile=theme.config.mqlSmall||theme.config.isTouch,this.motionReduced=theme.config.motionReduced||this.hasAttribute("motion-reduced"),this.addEventListener("change",this.onFormChange),this.addEventListener("submit",this.onFormSubmit)}getAnimationParams(){return{distance:this.isMobile?30:50,duration:this.motionReduced?.001:this.isMobile?.3:.5,staggerDelay:this.motionReduced?0:this.isMobile?.05:.1}}getVisibleItems(items){const viewportHeight=window.innerHeight+window.scrollY,visible=[],invisible=[];return items.forEach(item=>{const rect=item.getBoundingClientRect();rect.top<viewportHeight&&rect.bottom>0?visible.push(item):invisible.push(item)}),{visible,invisible}}onFormChange(){this.dirty=!0,this.dispatchEvent(new Event("submit",{cancelable:!0}))}onFormSubmit(event){if(event.preventDefault(),!this.dirty)return;const url=this.buildUrl().toString();this.renderSection(url,event)}buildUrl(){const searchParams=new URLSearchParams(new FormData(this)),url=new URL(this.action);return url.search="",searchParams.forEach((value,key)=>url.searchParams.append(key,value)),["page","filter.v.price.gte","filter.v.price.lte"].forEach(item=>{url.searchParams.get(item)===""&&url.searchParams.delete(item)}),url.searchParams.set("section_id",theme.utils.sectionId(this)),url}updateURLHash(url){const clonedUrl=new URL(url);clonedUrl.searchParams.delete("section_id"),history.replaceState({},"",clonedUrl.toString())}beforeRenderSection(){const container=document.getElementById("ProductGridContainer"),items=container.querySelectorAll(".product-card"),{distance,duration,staggerDelay}=this.getAnimationParams(),{visible:visibleItems,invisible:inVisibleItems}=this.getVisibleItems(items);Motion.timeline([[visibleItems,{y:distance,opacity:0,visibility:"hidden"},{duration,delay:Motion.stagger(staggerDelay)}],[inVisibleItems,{y:distance,opacity:0,visibility:"hidden"},{duration}],[container,{y:distance,opacity:0},{duration,easing:"linear"}]]),items.forEach(item=>item.style.removeProperty("transform"));let headerHeight=0;!theme.config.mqlSmall&&document.querySelector("header.header")&&(headerHeight=Math.round(document.querySelector("header.header").clientHeight)),setTimeout(()=>{const target=document.querySelector(".collection");window.scrollTo({top:target.getBoundingClientRect().top+window.scrollY-(theme.config.isTouch||theme.config.mqlSmall?95:20)-headerHeight,behavior:theme.config.motionReduced?"auto":"smooth"});const drawer=document.getElementById("FacetDrawer");drawer&&drawer.classList.add("loading")},100)}afterRenderSection(){const container=document.getElementById("ProductGridContainer"),items=container.querySelectorAll(".product-card"),{distance,duration,staggerDelay}=this.getAnimationParams(),{visible:visibleItems,invisible:inVisibleItems}=this.getVisibleItems(items);Motion.timeline([[container,{y:[distance,0],opacity:[0,1]},{duration,easing:"linear"}],[visibleItems,{y:[distance,0],opacity:[0,1],visibility:["hidden","visible"]},{duration,delay:Motion.stagger(staggerDelay)}],[inVisibleItems,{y:[distance,0],opacity:[0,1],visibility:["hidden","visible"]},{duration}]]),items.forEach(item=>item.style.removeProperty("transform"));const drawer=document.getElementById("FacetDrawer");drawer&&drawer.classList.remove("loading"),document.dispatchEvent(new CustomEvent("collection:reloaded"))}renderSection(url,event){this.cachedMap.has(url)?this.renderSectionFromCache(url,event):this.renderSectionFromFetch(url,event),this.hasAttribute("data-history")&&this.updateURLHash(url),this.dirty=!1}renderSectionFromFetch(url,event){this.abortController?.abort(),this.abortController=new AbortController,this.beforeRenderSection();const start=performance.now();fetch(url,{signal:this.abortController.signal}).then(response=>response.text()).then(responseText=>{const execution=performance.now()-start;setTimeout(()=>{this.renderFilters(responseText,event),this.renderFiltersActive(responseText),this.renderProductGridContainer(responseText),this.renderProductCount(responseText),this.renderSortBy(responseText),theme.pubsub.publish(theme.pubsub.PUB_SUB_EVENTS.facetUpdate,{responseText}),this.cachedMap.set(url,responseText),this.afterRenderSection()},execution>
1500?0:500)}).catch(error=>{error.name==="AbortError"?console.log("Fetch aborted by user"):console.error(error)})}renderSectionFromCache(url,event){this.beforeRenderSection(),setTimeout(()=>{const responseText=this.cachedMap.get(url);this.renderFilters(responseText,event),this.renderFiltersActive(responseText),this.renderProductGridContainer(responseText),this.renderProductCount(responseText),this.renderSortBy(responseText),theme.pubsub.publish(theme.pubsub.PUB_SUB_EVENTS.facetUpdate,{responseText}),this.afterRenderSection()},500)}renderFilters(responseText,event){const facetElements=new DOMParser().parseFromString(responseText,"text/html").querySelectorAll("#FacetFiltersContainer [data-filter], #MobileFacetFiltersContainer [data-filter]"),matchesIndex=element=>{const jsFilter=event?event.target.closest("[data-filter]"):void 0;return jsFilter?element.getAttribute("data-index")===jsFilter.getAttribute("data-index"):!1};Array.from(facetElements).filter(element=>!matchesIndex(element)).forEach(element=>{const filter=document.querySelector(`[data-filter][data-index="${element.getAttribute("data-index")}"]`);filter!==null&&(filter.tagName==="DETAILS"?filter.querySelector("summary + *").innerHTML=element.querySelector("summary + *").innerHTML:filter.innerHTML=element.innerHTML)})}renderFiltersActive(responseText){this._updateSection(responseText,"FacetFiltersActive")}renderProductGridContainer(responseText){this._updateSection(responseText,"ProductGridContainer",newContent=>{newContent.querySelector("motion-list")?.setAttribute("motion-reduced","")})}renderProductCount(responseText){this._updateSection(responseText,"ProductCount")}renderSortBy(responseText){this._updateSection(responseText,"SortByContainer",(newContent,oldContainer)=>{const oldFacetSort=oldContainer.querySelector("facet-sort"),newFacetSort=newContent.querySelector("facet-sort");!oldFacetSort||!newFacetSort||oldFacetSort.hasAttribute("style")&&newFacetSort.setAttribute("style",oldFacetSort.getAttribute("style"))})}_updateSection(responseText,sectionId,modifier=null){const container=document.getElementById(sectionId);if(!container)return!1;const newContent=new DOMParser().parseFromString(responseText,"text/html").getElementById(sectionId);return newContent?(modifier?.(newContent,container),container.innerHTML=newContent.innerHTML,!0):!1}},{extends:"form"}),customElements.get("facet-count")||customElements.define("facet-count",class extends HTMLElement{constructor(){super()}facetUpdateUnsubscriber=void 0;connectedCallback(){this.facetUpdateUnsubscriber=theme.pubsub.subscribe(theme.pubsub.PUB_SUB_EVENTS.facetUpdate,this.onFacetUpdate.bind(this))}disconnectedCallback(){this.facetUpdateUnsubscriber&&this.facetUpdateUnsubscriber()}get itemCount(){return parseInt(this.innerText)}onFacetUpdate(event){const facetCount=new DOMParser().parseFromString(event.responseText,"text/html").querySelector("facet-count");this.innerText=facetCount.innerHTML,this.hidden=this.itemCount===0}}),customElements.get("results-count")||customElements.define("results-count",class extends HTMLElement{constructor(){super()}facetUpdateUnsubscriber=void 0;connectedCallback(){this.facetUpdateUnsubscriber=theme.pubsub.subscribe(theme.pubsub.PUB_SUB_EVENTS.facetUpdate,this.onFacetUpdate.bind(this))}disconnectedCallback(){this.facetUpdateUnsubscriber&&this.facetUpdateUnsubscriber()}onFacetUpdate(event){const resultsCount=new DOMParser().parseFromString(event.responseText,"text/html").querySelector("results-count");this.innerText=resultsCount.innerHTML}}),customElements.get("facet-remove")||customElements.define("facet-remove",class extends MagnetLink{constructor(){super(),this.addEventListener("click",this.onClick)}onClick(event){const form=this.closest('form[is="facet-form"]')||document.querySelector('form[is="facet-form"]');if(form){event.preventDefault();const url=new URL(this.href);url.searchParams.set("section_id",theme.utils.sectionId(form)),form.renderSection(url.toString(),event)}}},{extends:"a"}),customElements.get("facet-sort")||customElements.define("facet-sort",class extends HTMLElement{constructor(){super(),Motion.inView(this,this.init.bind(this),{margin:"200px 0px 200px 0px"}),this.addEventListener("change",this.onChange),this.button.addEventListener("click",this.show.bind(this)),this.close.addEventListener("click",this.hide.bind(this)),document.addEventListener("click",this.onWindowClick.bind(this))}get listbox(){return this.querySelector(".sort-listbox")}get selection(){return this.querySelector(".sort-selection")}get button(){return this.querySelector(".sort-by")}get close(){return this.querySelector(".sort-close")}init(){this.initButton(),this.style.setProperty("--facet-listbox-height",`${this.listbox.getBoundingClientRect().height.toFixed(1)}px`)}initButton(){const value=this.selection.innerText,width=theme.getElementWidth(this.selection,value);this.style.setProperty("--facet-button-width",`${width}px`)}onChange(event){const form=this.closest('form[is="facet-form"]')||document.querySelector('form[is="facet-form"]');if(form){const url=new URL(window.location.href);
1url.searchParams.set("sort_by",event.target.value),url.searchParams.set("section_id",theme.utils.sectionId(form)),url.searchParams.delete("page"),form.renderSection(url.toString(),event)}this.selection.innerText=event.target.nextElementSibling.innerText,this.initButton(),this.hide()}show(){this.button.setAttribute("open","")}hide(immediate=!0){if(this.button.hasAttribute("open")){if(setTimeout(()=>{this.button.removeAttribute("open")},100),theme.config.isTouch||document.body.getAttribute("data-button-hover")==="none")return;const btnFill=this.button.querySelector("[data-fill");Motion.animate(btnFill,{y:["0%",immediate?"0%":"-76%"]},{duration:.6,delay:immediate?0:.2})}}onWindowClick(event){this.contains(event.target)||this.button.hasAttribute("open")&&this.hide(!1)}}),customElements.get("facet-sticky")||customElements.define("facet-sticky",class extends HTMLElement{constructor(){super(),new IntersectionObserver(this.handleIntersection.bind(this),{rootMargin:`-${screen.availHeight-200}px 0px ${screen.availHeight}px 0px`}).observe(document.querySelector(".collection-section"))}get button(){return this.querySelector(".button")}handleIntersection(entries){entries[0].isIntersecting?Motion.animate(this.button,{opacity:1,visibility:"visible",transform:["translateY(15px)","translateY(0)"]},{duration:1,easing:[.16,1,.3,1]}):Motion.animate(this.button,{opacity:0,visibility:"hidden",transform:["translateY(0)","translateY(15px)"]},{duration:1,easing:[.16,1,.3,1]})}}),customElements.get("price-range")||customElements.define("price-range",class extends HTMLElement{constructor(){super(),this.rangeMin=this.querySelector('input[type="range"]:first-child'),this.rangeMax=this.querySelector('input[type="range"]:last-child'),this.inputMin=this.querySelector('input[name="filter.v.price.gte"]'),this.inputMax=this.querySelector('input[name="filter.v.price.lte"]'),this.inputMin.addEventListener("focus",this.inputMin.select),this.inputMax.addEventListener("focus",this.inputMax.select),this.inputMin.addEventListener("change",this.onInputMinChange.bind(this)),this.inputMax.addEventListener("change",this.onInputMaxChange.bind(this)),this.rangeMin.addEventListener("change",this.onRangeMinChange.bind(this)),this.rangeMax.addEventListener("change",this.onRangeMaxChange.bind(this)),this.rangeMin.addEventListener("input",this.onRangeMinInput.bind(this)),this.rangeMax.addEventListener("input",this.onRangeMaxInput.bind(this))}onInputMinChange(event){event.preventDefault();const target=event.target;target.value=Math.max(Math.min(parseInt(target.value||target.min),parseInt(this.inputMax.value||target.max)-1),target.min),this.rangeMin.value=target.value,this.rangeMin.parentElement.style.setProperty("--range-min",`${parseInt(this.rangeMin.value)/parseInt(this.rangeMin.max)*100}%`)}onInputMaxChange(event){event.preventDefault();const target=event.target;target.value=Math.min(Math.max(parseInt(target.value||target.max),parseInt(this.inputMin.value||target.min)+1),target.max),this.rangeMax.value=target.value,this.rangeMax.parentElement.style.setProperty("--range-max",`${parseInt(this.rangeMax.value)/parseInt(this.rangeMax.max)*100}%`)}onRangeMinChange(event){event.stopPropagation(),this.inputMin.value=event.target.value,this.inputMin.dispatchEvent(new Event("change",{bubbles:!0}))}onRangeMaxChange(event){event.stopPropagation(),this.inputMax.value=event.target.value,this.inputMax.dispatchEvent(new Event("change",{bubbles:!0}))}onRangeMinInput(event){event.target.value=Math.min(parseInt(event.target.value),parseInt(this.inputMax.value||event.target.max)-1),event.target.parentElement.style.setProperty("--range-min",`${parseInt(event.target.value)/parseInt(event.target.max)*100}%`),this.inputMin.value=event.target.value}onRangeMaxInput(event){event.target.value=Math.max(parseInt(event.target.value),parseInt(this.inputMin.value||event.target.min)+1),event.target.parentElement.style.setProperty("--range-max",`${parseInt(event.target.value)/parseInt(event.target.max)*100}%`),this.inputMax.value=event.target.value}}),customElements.get("infinite-button")||customElements.define("infinite-button",class extends HoverButton{constructor(){super(),this.onClickHandler=this.onClick.bind(this)}connectedCallback(){this.addEventListener("click",this.onClickHandler),this.getAttribute("mode")=="infinite"&&Motion.inView(this,this.onClickHandler,{margin:"200px 0px 200px 0px"})}disconnectedCallback(){this.removeEventListener("click",this.onClickHandler)}onClick(){if(this.hasAttribute("aria-busy"))return;this.abortController?.abort(),this.abortController=new AbortController,this.enableLoading();const url=this.buildUrl().toString();fetch(url,{signal:this.abortController.signal}).then(response=>response.text()).then(responseText=>{this.renderPagination(responseText),this.renderProductGridContainer(responseText)}).catch(error=>{error.name==="AbortError"?console.log("Fetch aborted by user"):console.error(error)})}renderPagination(responseText){const productGridContainer=document.getElementById("ProductGridContainer");if(productGridContainer===null)return;const parsedHTML=new DOMParser().parseFromString(responseText,"text/html"),destination=productGridContainer.querySelector(".pagination"),source=parsedHTML.querySelector(".pagination");source?destination.innerHTML=source.innerHTML:destination.remove()}renderProductGridContainer(responseText){const productGridContainer=document.getElementById("ProductGridContainer");if(productGridContainer===null)return;const parsedHTML=new DOMParser().parseFromString(responseText,"text/html"),destination=productGridContainer.querySelector("motion-list"),source=parsedHTML.querySelector("motion-list");source&&destination&&(source.querySelectorAll(".card").forEach(item=>{destination.appendChild(item)}),destination.reload())}buildUrl(){const url=new URL(this.getAttribute("action"));return url.searchParams.set("section_id",theme.utils.sectionId(this)),url}enableLoading(){this.classList.add("pointer-events-none"),this.setAttribute("aria-busy","true")}},{extends:"button"}),customElements.get("facets-topbar")||customElements.define("facets-topbar",class extends StickyElement{constructor(){super()}positionStickySidebar(){this.getBoundingClientRect().top===0?document.body.classList.add("facets-topbar--active"):document.body.classList.remove("facets-topbar--active")}}),customElements.get("model-view")||customElements.define("model-view",class extends MagnetButton{constructor(){super(),Motion.inView(this,this.init.bind(this),{margin:"200px 0px 200px 0px"}),this._open=this.hasAttribute("open"),this.onClickHandler=this.onClick.bind(this),this.textSpans=this.querySelectorAll(".link-text")}set open(value){value!==this._open&&(this._open=value,value?this.setAttribute("open",""):this.removeAttribute("open"))}static get observedAttributes(){return["open"]}get open(){return this._open}connectedCallback(){this.addEventListener("click",this.onClickHandler)}disconnectedCallback(){this.removeEventListener("click",this.onClickHandler)}attributeChangedCallback(name,oldValue,newValue){if(name==="open"){const isActive=newValue==="";this.setActiveModel(isActive),this.updateAccessibility(isActive)}}init(){if(theme.config.hasLocalStorage){const isActive=window.localStorage.getItem(`${theme.settings.themeName}:model-view`)||"false";this.open=isActive==="true"}}onClick(event){event.preventDefault(),this.open=!this.open}setActiveModel(isActive){const container=document.getElementById("ProductGridContainer");container.classList.toggle("lifestyle",isActive),container.querySelectorAll("video-media").forEach(videoMedia=>videoMedia.pause()),theme.config.hasLocalStorage&&window.localStorage.setItem(`${theme.settings.themeName}:model-view`,isActive)}updateAccessibility(isActive){if(this.textSpans.length===2){const[defaultText,activeText]=this.textSpans;this.setAttribute("aria-label",isActive?activeText.textContent.trim():defaultText.textContent.trim())}}},{extends:"button"}),customElements.get("sub-collections")||customElements.define("sub-collections",class extends HTMLSelectElement{constructor(){super(),this.addEventListener("change",this.onChange)}onChange(){window.location.href=this.value}},{extends:"select"}); 2//# sourceMappingURL=/cdn/shop/t/45/assets/collection.js.map?v=102030528375844515951778619152
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.