1if(!customElements.get("recommended-products")){class RecommendedProducts extends HTMLElement{constructor(){super(),this.dataset.load!="manual"&&this.loadRecommendations()}async loadRecommendations(){const productIds=this.dataset.productIds,limit=parseInt(this.dataset.limit,10)||10,perRequestLimit=parseInt(this.dataset.perRequestLimit,10)||limit,templateRootElement=this.querySelector("template").content.cloneNode(!0).querySelector(".products-carousel-root"),itemsContent=templateRootElement.querySelector(".keen-slider, .grid"),intent=this.dataset.intent;let queries=[];const ids=productIds&&productIds.replaceAll(" ","").split(",").filter(Boolean)||[];for(let i=0;i<ids.length;i++)queries.splice(i,0,{id:ids[i],intent:intent=="related"?"related":"complementary"}),i==0&&intent=="mixed"&&queries.push({id:ids[i],intent:"related"});queries.forEach(x=>{x.url=routes.product_recommendations_url+`?product_id=${x.id}&limit=${perRequestLimit}§ion_id=recommended_products_view&intent=${x.intent}`});var urls=queries.map(x=>x.url);const data=urls.length>0?await $s.getDataFromUrls(urls):{};var cardsHtml=[],parser=new DOMParser,productsLoaded={},shown=0;queries.forEach(x=>{var url=x.url,text=data[url];if(text&&text.indexOf("data-recommendation-type")>-1){var html=itemsContent.classList.contains("grid")?text.replaceAll("keen-slider-slide","grid-item"):text,sectionId=this.closest(".shopify-section")?.id;sectionId&&(html=html.replaceAll("recommended_products_view",sectionId));var doc=parser.parseFromString(html,"text/html");doc.querySelectorAll(".product-card").forEach(card=>{const cardId=card.dataset.productId;shown<limit&&cardId&&!productsLoaded[cardId]&&(shown++,productsLoaded[cardId]=1,cardsHtml.push(card.parentNode.outerHTML))})}}),this.dataset.shuffle&&(cardsHtml=(array=>{for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[array[i],array[j]]=[array[j],array[i]]}return array})(cardsHtml)),itemsContent.innerHTML=cardsHtml.join(""),itemsContent.querySelectorAll(".product-card").forEach(card=>{this.dataset.cardsColorScheme&&card.classList.add("scheme",...this.dataset.cardsColorScheme.split(" ")),this.dataset.cardsColorScheme==this.dataset.contentColorScheme?(card.classList.add("same-scheme-true"),card.classList.remove("same-scheme-false")):(card.classList.add("same-scheme-false"),card.classList.remove("same-scheme-true"))}),this.querySelector(".products-carousel-root")?.remove(),this.insertAdjacentElement("beforeend",templateRootElement),this.querySelectorAll("component-carousel").forEach(el=>{if(el.sliderElement=el.querySelector(".keen-slider"),el.slides=el.querySelectorAll(".keen-slider-slide"),el.initialized=!1,el.sliderObj&&typeof el.sliderObj.destroy=="function"){try{el.sliderObj.destroy()}catch{}el.sliderObj=null}el.initSlider&&setTimeout(()=>el.initSlider(),1)}),shown>0?(this.style.display="",$s.dispatchEvent(this,"recommendations:show")):(this.style.display="none",$s.dispatchEvent(this,"recommendations:hide"))}}customElements.define("recommended-products",RecommendedProducts)} 2//# sourceMappingURL=/cdn/shop/t/967/assets/recommended_products.js.map?v=109225332045081894141789046454
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.