1if(!window.customElements.get("recently-viewed-products")){class RecentlyViewedProducts extends HTMLElement{constructor(){super(),this.observer=new IntersectionObserver(this.onIntersect.bind(this),{threshold:.2})}connectedCallback(){this.observer.observe(this)}async onIntersect(entries){for(const entry of entries)if(entry.isIntersecting){this.observer.unobserve(entry.target);const query=this.buildQuery();query&&this.loadProducts(query)}}buildQuery(){const items=JSON.parse(localStorage.getItem("recently-viewed")||"[]"),excludeId=this.getAttribute("exclude-id");if(excludeId){const index=items.indexOf(parseInt(excludeId));index!==-1&&items.splice(index,1)}return items.slice(0,this.productLimit).map(id=>`id:${id}`).join(" OR ")}async loadProducts(query){try{const html=await(await fetch(`${theme.routes.root_url}search?q=${query}&resources[limit]=10&resources[type]=product§ion_id=${this.sectionId}`)).text(),products=new DOMParser().parseFromString(html,"text/html").querySelector("recently-viewed-products");products&&products.hasChildNodes()&&(this.innerHTML=products.innerHTML)}catch(error){console.error("Error fetching products:",error)}}get sectionId(){return this.getAttribute("section-id")}get productLimit(){return parseInt(this.getAttribute("products-limit"))||4}}window.customElements.define("recently-viewed-products",RecentlyViewedProducts)} 2//# sourceMappingURL=/cdn/shop/t/280/assets/recently-viewed-products.js.map?v=49755392899993825231787170654
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.