import{ThemeEvents}from"@theme/events";import{morph}from"@theme/morph";class ProductInventory extends HTMLElement{connectedCallback(){this.closest(".shopify-section, dialog")?.addEventListener(ThemeEvents.variantUpdate,this.updateInventory)}disconnectedCallback(){this.closest(".shopify-section, dialog")?.removeEventListener(ThemeEvents.variantUpdate,this.updateInventory)}updateInventory=event=>{if(event.detail.data.newProduct)this.dataset.productId=event.detail.data.newProduct.id;else if(event.target instanceof HTMLElement&&event.target.dataset.productId!==this.dataset.productId)return;const newInventory=event.detail.data.html.querySelector("product-inventory");newInventory&&morph(this,newInventory,{childrenOnly:!0})}}customElements.get("product-inventory")||customElements.define("product-inventory",ProductInventory);
//# sourceMappingURL=/s/files/1/0677/1399/0759/t/1/assets/product-inventory.js.map?v=1783128602
