1customElements.define("recently-viewed-products",class extends HTMLElement{constructor(){super(),this.template=document.getElementById("recently-viewed-products-template").content.firstElementChild.cloneNode(!0),this.template.querySelector(".gridy-track").innerHTML="",this.slider=this.template.querySelector("gridy-slider"),this.sliderArrows=this.template.querySelector(".gridy-arrows"),this.data_ipr_desktop=parseInt(this.slider.dataset.iprDesktop,10)||1,this.data_ipr_tablet=parseInt(this.slider.dataset.iprTablet,10)||data_ipr_desktop,this.data_ipr_mobile=parseInt(this.slider.dataset.iprMobile,10)||1,this.limit=this.dataset.limit,this.currentTemplate=this.dataset.currentTemplate,this.showAsThumbnails=this.dataset.showAsThumbnails!=null?JSON.parse(this.dataset.showAsThumbnails):!1,this.history=sessionStorage.getItem("Woolman_Product_History")?sessionStorage.getItem("Woolman_Product_History").split(","):[],!(this.currentTemplate==="template-product"&&this.history.length<=1||this.history.length===0)&&this.fetchProductHtml()}async fetchProductHtml(){let currentIndex=1;const promises=[],rootUrl=window.routes.root=="/"?"/":window.routes.root+"/";this.currentTemplate==="template-product"&&this.history.shift();const div=document.createElement("div");for(var i=0;i<this.history.length;i++)div.setAttribute("data-index",i),this.template.querySelector(".gridy-track").appendChild(div.cloneNode(!0));for(const productHandle of this.history){let cardView="ajax-card";if(this.showAsThumbnails&&(cardView="ajax-card-thumbnail"),promises.push(fetch(`${rootUrl}products/${productHandle}?view=${cardView}`)),currentIndex++,currentIndex>this.limit)break}const forEachPromises=(await Promise.allSettled(promises)).map(async(promise,index)=>{try{const res=await promise.value;if(res.status!==200)throw res.status;const htmlString=await res.text(),doc=new DOMParser().parseFromString(htmlString,"text/html"),childToReplace=this.template.querySelector(`[data-index="${index}"]`);childToReplace.parentNode.replaceChild(doc.body.firstChild,childToReplace)}catch(err){console.error(err)}});await Promise.all(forEachPromises).then(()=>{this.data_ipr_mobile>=this.history.length&&this.sliderArrows.classList.add("sm-down-hide"),this.data_ipr_tablet>=this.history.length&&this.sliderArrows.classList.add("sm-to-md-hide"),this.data_ipr_desktop>=this.history.length&&this.sliderArrows.classList.add("md-hide"),this.appendChild(this.template),this.removeAttribute("hidden")})}}); 2//# sourceMappingURL=/cdn/shop/t/104/assets/section-recently-viewed-products.js.map?v=50213804452094930191789996707
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.