1if(!customElements.get("product-inventory")){class ProductInventory extends HTMLElement{constructor(){super(),this.hidden?this.initLazySection():window.initLazyScript(this,this.initLazySection.bind(this))}initLazySection(){this.inventoryNotice=this.querySelector(".js-inventory-notice"),this.urgencyMessage=this.querySelector(".js-inventory-urgency"),this.indicatorBar=this.querySelector(".js-inventory-indicator"),this.variantInventory=this.getVariantInventory();const variantPicker=this.closest(".product-info").querySelector("variant-picker");variantPicker&&variantPicker.addEventListener("on:variant:change",this.handleVariantChange.bind(this));const currentVariantInventory=this.variantInventory.find(variant=>variant.id===parseInt(this.dataset.currentVariantId,10));this.updateInventory(parseInt(this.dataset.inventoryQuantity,10),this.dataset.variantAvailable==="true",this.dataset.inventoryPolicy,currentVariantInventory?currentVariantInventory.preorder:!1)}getVariantInventory(){const dataEl=this.querySelector('[type="application/json"]');return this.variantInventory||JSON.parse(dataEl.textContent)}handleVariantChange(evt){if(evt.detail.variant){const inventory=this.variantInventory.filter(variant=>variant.id===evt.detail.variant.id)[0];this.updateInventory(inventory.inventory_quantity,inventory.available,inventory.inventory_policy,inventory.preorder)}else this.updateInventory(0,!1),this.hidden=!0}updateInventory(count,available,inventoryPolicy,preorder=!1){if(!preorder&&count===0&&!available&&this.hidden)return;let inventoryLevel;if(preorder){this.hidden=!0;return}else count<=0?inventoryPolicy==="continue"?inventoryLevel="backordered":available?inventoryLevel="in_stock":inventoryLevel="none":count<=parseInt(this.dataset.thresholdVeryLow,10)?inventoryLevel="very_low":count<=parseInt(this.dataset.thresholdLow,10)?inventoryLevel="low":inventoryLevel="normal";if((this.dataset.showNotice==="always"||this.dataset.showNotice==="low"&&inventoryLevel.includes("low"))&&!(inventoryLevel==="backordered"&&this.dataset.showNoStockBackordered==="false")){if(this.hidden=!1,this.setAttribute("data-inventory-level",inventoryLevel),this.dataset.vendorDeliveryText&&(inventoryLevel==="normal"||inventoryLevel==="in_stock")?(this.inventoryNotice.innerText=this.dataset.vendorDeliveryText,this.inventoryNotice.style.color=this.dataset.vendorDeliveryColor||""):inventoryLevel==="backordered"?this.inventoryNotice.innerText="":inventoryLevel!=="in_stock"&&(this.dataset.showCount==="always"||this.dataset.showCount==="low"&&inventoryLevel.includes("low"))?this.inventoryNotice.innerText=theme.strings.onlyXLeft.replace("[quantity]",count):inventoryLevel==="very_low"?this.inventoryNotice.innerText=theme.strings.veryLowStock:inventoryLevel==="low"?this.inventoryNotice.innerText=theme.strings.lowStock:inventoryLevel==="normal"||inventoryLevel==="in_stock"?(this.inventoryNotice.innerText=theme.strings.inStock,this.inventoryNotice.style.color=""):inventoryLevel==="none"&&(this.inventoryNotice.innerText=theme.strings.noStock),this.urgencyMessage&&(inventoryLevel==="very_low"?this.urgencyMessage.innerHTML=this.dataset.textVeryLow:inventoryLevel==="low"?this.urgencyMessage.innerHTML=this.dataset.textLow:inventoryLevel==="backordered"?this.urgencyMessage.innerHTML=this.dataset.textNoStockBackordered:inventoryLevel==="normal"||inventoryLevel==="in_stock"?this.urgencyMessage.innerHTML=this.dataset.textNormal:inventoryLevel==="none"&&(this.urgencyMessage.innerHTML=this.dataset.textNoStock)),this.indicatorBar){this.indicatorBar.hidden=!1;let newWidth;(count>=this.dataset.scale||inventoryLevel==="in_stock")&&inventoryLevel!=="backordered"?newWidth=100:newWidth=(100/parseInt(this.dataset.scale,10)*count).toFixed(1),this.indicatorBar.querySelector("span").style.width=`${newWidth}%`}}else this.hidden=!0}}customElements.define("product-inventory",ProductInventory)} 2//# sourceMappingURL=/cdn/shop/t/29/assets/product-inventory.js.map?v=125165304371126023871788176887
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.