1class RecentlyViewed extends HTMLElement{constructor(){super()}connectedCallback(){this.cookie=this.getCookie("recently-viewed"),this.maxProducts=4,this.grid=this.querySelector(".grid"),this.showRecentlyViewed(),this.recordRecentlyViewed()}recordRecentlyViewed(){if(!this.cookie){this.cookie=Theme.Liquid.product.handle,this.setCookie("recently-viewed",this.cookie,30);return}const cookieArray=this.cookie.split(",");if(cookieArray.indexOf(Theme.Liquid.product.handle)!==-1||Theme.Liquid.product.title.indexOf("Screen Protector")!==-1)return;cookieArray.push(Theme.Liquid.product.handle);const newCookie=cookieArray.slice(-this.maxProducts).join(",");this.setCookie("recently-viewed",newCookie,30)}showRecentlyViewed(){if(!this.cookie)return;const cookieArray=this.cookie.split(",");let products=[];cookieArray.forEach(productHandle=>{fetch(`/products/${productHandle}?view=card-product`).then(response=>{if(response.ok)return response.text()}).then(data=>{products.push(data),products.length===cookieArray.length&&this.render(products)}).catch(error=>{console.log(error)})})}render(products){products.forEach(product=>{let li=document.createElement("li");li.classList.add("grid__item"),li.innerHTML=product,this.grid.appendChild(li),lazyImages()})}getCookie(name){var v=document.cookie.match("(^|;) ?"+name+"=([^;]*)(;|$)");return v?v[2]:!1}setCookie(name,value,days){var d=new Date;d.setTime(d.getTime()+1440*60*1e3*days),document.cookie=name+"="+value+";path=/;expires="+d.toGMTString()}}customElements.define("recently-viewed",RecentlyViewed); 2//# sourceMappingURL=/cdn/shop/t/204/assets/component-recently-viewed.js.map?v=82425239200469346831777600809
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.