1customElements.get("product-info")||customElements.define("product-info",class extends HTMLElement{constructor(){super(),this.input=this.querySelector(".quantity__input"),this.currentVariant=this.querySelector(".product-variant-id"),this.submitButton=this.querySelector('[type="submit"]')}cartUpdateUnsubscriber=void 0;variantChangeUnsubscriber=void 0;connectedCallback(){this.fetchCustomProductData(),this.input&&(this.quantityForm=this.querySelector(".product-form__quantity"),this.quantityForm&&(this.setQuantityBoundries(),this.dataset.originalSection||(this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,this.fetchQuantityRules.bind(this))),this.variantChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.variantChange,event=>{const sectionId=this.dataset.originalSection?this.dataset.originalSection:this.dataset.section;event.data.sectionId===sectionId&&(this.updateQuantityRules(event.data.sectionId,event.data.html),this.setQuantityBoundries())})))}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber(),this.variantChangeUnsubscriber&&this.variantChangeUnsubscriber()}setQuantityBoundries(){const data={cartQuantity:this.input.dataset.cartQuantity?parseInt(this.input.dataset.cartQuantity):0,min:this.input.dataset.min?parseInt(this.input.dataset.min):1,max:this.input.dataset.max?parseInt(this.input.dataset.max):null,step:this.input.step?parseInt(this.input.step):1};let min=data.min;const max=data.max===null?data.max:data.max-data.cartQuantity;max!==null&&(min=Math.min(min,max)),data.cartQuantity>=data.min&&(min=Math.min(min,data.step)),this.input.min=min,max?this.input.max=max:this.input.removeAttribute("max"),this.input.value=min,publish(PUB_SUB_EVENTS.quantityUpdate,void 0)}fetchQuantityRules(){!this.currentVariant||!this.currentVariant.value||(this.querySelector(".quantity__rules-cart .loading__spinner").classList.remove("hidden--important"),fetch(`${this.dataset.url}?variant=${this.currentVariant.value}§ion_id=${this.dataset.section}`).then(response=>response.text()).then(responseText=>{const html=new DOMParser().parseFromString(responseText,"text/html");this.updateQuantityRules(this.dataset.section,html),this.setQuantityBoundries()}).catch(e=>{console.error(e)}).finally(()=>{this.querySelector(".quantity__rules-cart .loading__spinner").classList.add("hidden--important")}))}updateQuantityRules(sectionId,html){const quantityFormUpdated=html.getElementById(`Quantity-Form-${sectionId}`),selectors=[".quantity__input",".quantity__rules",".quantity__label"];for(let selector of selectors){const current=this.quantityForm.querySelector(selector),updated=quantityFormUpdated.querySelector(selector);if(!(!current||!updated))if(selector===".quantity__input"){const attributes=["data-cart-quantity","data-min","data-max","step"];for(let attribute of attributes){const valueUpdated=updated.getAttribute(attribute);valueUpdated!==null?current.setAttribute(attribute,valueUpdated):current.removeAttribute(attribute)}}else current.innerHTML=updated.innerHTML}}fetchCustomProductData(){const productUrl=this.dataset.url;if(!productUrl)return;const handle=productUrl.split("/").pop();fetch(`/products/${handle}?view=custom`).then(response=>{if(!response.ok)throw new Error("Failed load custom product data");return response.json()}).then(data=>(this.trackProductView(data),data)).catch(error=>{console.error("Error fetching custom product data:",error)})}constructAnalyticsPayload(data){const{metafields,product}=data;if(!metafields)return null;const{material,color,db_condition,discounted_tier,discounted_rate,style,categories}=metafields,PRICE_DIVISOR=100,compareAtPrice=parseFloat(product.compare_at_price)/PRICE_DIVISOR,currentPrice=parseFloat(product.price)/PRICE_DIVISOR,categoryNames=categories?categories.map(category=>category.name):[];return{brand:product.vendor||"",categories:categoryNames,category:product.type||"",color,compare_at_price:compareAtPrice,condition:db_condition,currency:"USD",days_on_sale:0,discount_tier:discounted_tier,is_sold_out:product.available?0:1,material,name:product.title||"",price:currentPrice,product_discount_amount:compareAtPrice-currentPrice,product_discount_rate:discounted_rate,product_id:product.id,quantity:1,sku:product.variants?.[0]?.sku||"",style,url:window.location.href,value:compareAtPrice}}trackProductView(data){try{const payload=this.constructAnalyticsPayload(data);segmentTrack({eventName:"Product Viewed",payload})}catch(error){console.error("Error tracking product view:",error)}}}),document.addEventListener("pointerdown",function(event){if(event.target.closest("button.swym-add-to-wis
1hlist-view-product")&&(!isLoggedIn||isLoggedIn==="false")){event.preventDefault(),event.stopImmediatePropagation();const loginUrl=getLoginUrl();window.location.replace(loginUrl)}}),sessionStorage.setItem("cameFrom",document.referrer),window.addEventListener("popstate",function(){const cameFrom=sessionStorage.getItem("cameFrom");cameFrom&&!cameFrom.includes(window.location.pathname)?window.location.href=cameFrom:window.history.go(-2)}); 2//# sourceMappingURL=/cdn/shop/t/6/assets/product-info.js.map?v=71997906739671862031770931867
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.