import{Component}from"@theme/component";import"@theme/events";import{StandardEvents}from"@shopify/events";class ProductSkuComponent extends Component{requiredRefs=["skuContainer","sku"];connectedCallback(){super.connectedCallback();const target=this.closest('[id*="ProductInformation-"], [id*="QuickAdd-"], product-card');target&&target.addEventListener(StandardEvents.productSelect,this.#handleProductSelect)}disconnectedCallback(){super.disconnectedCallback();const target=this.closest('[id*="ProductInformation-"], [id*="QuickAdd-"], product-card');target&&target.removeEventListener(StandardEvents.productSelect,this.#handleProductSelect)}#handleProductSelect=event=>{event.promise.then(({detail})=>{if(!detail)return;const{newProduct,resource}=detail;if(newProduct&&(this.dataset.productId=newProduct.id),!(detail.productId&&detail.productId!==this.dataset.productId)&&resource){const variantSku=resource.sku||"";variantSku?(this.style.display="block",this.refs.sku.textContent=variantSku):(this.style.display="none",this.refs.sku.textContent="")}}).catch(error=>{error?.name!=="AbortError"&&console.warn("[product-sku] Event promise rejected:",error)})}}customElements.get("product-sku-component")||customElements.define("product-sku-component",ProductSkuComponent);
//# sourceMappingURL=/s/files/1/0677/1399/0759/t/1/assets/product-sku.js.map?v=1783078800
