1import{mediaQueryLarge,requestIdleCallback,startViewTransition}from"@theme/utilities";import PaginatedList from"@theme/paginated-list";import{sectionRenderer}from"@theme/section-renderer";import{FilterUpdateEvent}from"@theme/events";export default class ResultsList extends PaginatedList{connectedCallback(){super.connectedCallback(),mediaQueryLarge.addEventListener("change",this.#handleMediaQueryChange),!this.hasAttribute("initialized")&&(this.setAttribute("initialized",""),this.#applyURLFiltersOnLoad())}#applyURLFiltersOnLoad(){const resultsUrl=this.getAttribute("results-url");if(!resultsUrl)return;const resultsBase=new URL(resultsUrl,window.location.origin),currentUrl=new URL(window.location.href);if(resultsBase.pathname===currentUrl.pathname)return;const renderUrl=new URL(this.pageBaseURL);this.dispatchEvent(new FilterUpdateEvent(currentUrl.searchParams)),sectionRenderer.renderSection(this.sectionId,{url:renderUrl}).catch(()=>{this.removeAttribute("data-filters-pending")})}disconnectedCallback(){mediaQueryLarge.removeEventListener("change",this.#handleMediaQueryChange)}updateLayout({target}){target instanceof HTMLInputElement&&this.#animateLayoutChange(target.value)}#animateLayoutChange=async value=>{const{grid}=this.refs;grid&&(await startViewTransition(()=>this.#setLayout(value),["product-grid"]),requestIdleCallback(()=>{const viewport=mediaQueryLarge.matches?"desktop":"mobile";sessionStorage.setItem(`product-grid-view-${viewport}`,value)}))};#setLayout(value){const{grid}=this.refs;grid&&grid.setAttribute("product-grid-view",value)}get pageBaseURL(){const resultsUrl=this.getAttribute("results-url");if(!resultsUrl)return window.location.href;const resultsBase=new URL(resultsUrl,window.location.origin),currentUrl=new URL(window.location.href);if(resultsBase.pathname===currentUrl.pathname)return window.location.href;for(const[key,value]of currentUrl.searchParams.entries())(key.startsWith("filter.")||key==="sort_by")&&resultsBase.searchParams.append(key,value);return resultsBase.href}async onPaginationControlClick(data,event){event.preventDefault();const fetchURL=new URL(this.pageBaseURL),historyUrl=new URL(window.location.href);for(const[key,value]of Object.entries(data))key.startsWith("filter.")||key==="sort_by"||(fetchURL.searchParams.set(key,value),historyUrl.searchParams.set(key,value));history.pushState("","",historyUrl.toString()),await sectionRenderer.renderSection(this.sectionId,{url:fetchURL}),this.scrollIntoView({behavior:"smooth",block:"start"})}#handleMediaQueryChange=event=>{const targetElement=event.matches?this.querySelector('[data-grid-layout="desktop-default-option"]'):this.querySelector('[data-grid-layout="mobile-option"]');targetElement instanceof HTMLInputElement&&(targetElement.checked=!0,this.#setLayout("default"))}}customElements.get("results-list")||customElements.define("results-list",ResultsList); 2//# sourceMappingURL=/cdn/shop/t/143/assets/results-list.js.map?v=180049020982309116231780338881
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.