{
  "version": 3,
  "sources": ["/cdn/shop/t/1/assets/product-price.js?v=117989390664188536191768528522"],
  "sourcesContent": ["import { ThemeEvents, VariantUpdateEvent } from '@theme/events';\n\n/**\n * A custom element that displays a product price.\n * This component listens for variant update events and updates the price display accordingly.\n * It handles price updates from two different sources:\n * 1. Variant picker (in quick add modal or product page)\n * 2. Swatches variant picker (in product cards)\n */\nclass ProductPrice extends HTMLElement {\n  connectedCallback() {\n    const closestSection = this.closest('.shopify-section, dialog');\n    if (!closestSection) return;\n    closestSection.addEventListener(ThemeEvents.variantUpdate, this.updatePrice);\n  }\n\n  disconnectedCallback() {\n    const closestSection = this.closest('.shopify-section, dialog');\n    if (!closestSection) return;\n    closestSection.removeEventListener(ThemeEvents.variantUpdate, this.updatePrice);\n  }\n\n  /**\n   * Updates the price and volume pricing note.\n   * @param {VariantUpdateEvent} event - The variant update event.\n   */\n  updatePrice = (event) => {\n    if (event.detail.data.newProduct) {\n      this.dataset.productId = event.detail.data.newProduct.id;\n    } else if (event.target instanceof HTMLElement && event.target.dataset.productId !== this.dataset.productId) {\n      return;\n    }\n\n    // Find the new product-price element in the updated HTML\n    const newProductPrice = event.detail.data.html.querySelector(`product-price[data-block-id=\"${this.dataset.blockId}\"]`);\n    if (!newProductPrice) return;\n\n    // Update price container\n    const newPrice = newProductPrice.querySelector('[ref=\"priceContainer\"]');\n    const currentPrice = this.querySelector('[ref=\"priceContainer\"]');\n    if (newPrice && currentPrice) currentPrice.replaceWith(newPrice);\n\n    // Update volume pricing note\n    const currentNote = this.querySelector('.volume-pricing-note');\n    const newNote = newProductPrice.querySelector('.volume-pricing-note');\n\n    if (!newNote) {\n      currentNote?.remove();\n    } else if (!currentNote) {\n      this.querySelector('[ref=\"priceContainer\"]')?.insertAdjacentElement('afterend', /** @type {Element} */ (newNote.cloneNode(true)));\n    } else {\n      currentNote.replaceWith(newNote);\n    }\n  };\n}\n\nif (!customElements.get('product-price')) {\n  customElements.define('product-price', ProductPrice);\n}\n"],
  "mappings": "AAAA,OAAS,gBAAuC,gBAShD,MAAM,qBAAqB,WAAY,CACrC,mBAAoB,CAClB,MAAM,eAAiB,KAAK,QAAQ,0BAA0B,EACzD,gBACL,eAAe,iBAAiB,YAAY,cAAe,KAAK,WAAW,CAC7E,CAEA,sBAAuB,CACrB,MAAM,eAAiB,KAAK,QAAQ,0BAA0B,EACzD,gBACL,eAAe,oBAAoB,YAAY,cAAe,KAAK,WAAW,CAChF,CAMA,YAAe,OAAU,CACvB,GAAI,MAAM,OAAO,KAAK,WACpB,KAAK,QAAQ,UAAY,MAAM,OAAO,KAAK,WAAW,WAC7C,MAAM,kBAAkB,aAAe,MAAM,OAAO,QAAQ,YAAc,KAAK,QAAQ,UAChG,OAIF,MAAM,gBAAkB,MAAM,OAAO,KAAK,KAAK,cAAc,gCAAgC,KAAK,QAAQ,OAAO,IAAI,EACrH,GAAI,CAAC,gBAAiB,OAGtB,MAAM,SAAW,gBAAgB,cAAc,wBAAwB,EACjE,aAAe,KAAK,cAAc,wBAAwB,EAC5D,UAAY,cAAc,aAAa,YAAY,QAAQ,EAG/D,MAAM,YAAc,KAAK,cAAc,sBAAsB,EACvD,QAAU,gBAAgB,cAAc,sBAAsB,EAE/D,QAEO,YAGV,YAAY,YAAY,OAAO,EAF/B,KAAK,cAAc,wBAAwB,GAAG,sBAAsB,WAAoC,QAAQ,UAAU,EAAI,CAAE,EAFhI,aAAa,OAAO,CAMxB,CACF,CAEK,eAAe,IAAI,eAAe,GACrC,eAAe,OAAO,gBAAiB,YAAY",
  "names": []
}
