!function(){"use strict";function e(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class t extends GP.Component{constructor(){var t;super(),e(this,"priceType",void 0),e(this,"uid",void 0),e(this,"isComparePrice",void 0),e(this,"moneyFormat",void 0),e(this,"changeDisplayPrice",e=>{let t=this.getPriceText(e),i=this.querySelector(`#p-price-${this.uid} .gp-price`);i&&(i.innerHTML=t)}),e(this,"checkHiddenComparePrice",e=>{if(this.isComparePrice){let t=e&&e.compare_at_price&&e.compare_at_price>=0&&e.compare_at_price>=e.price;t?this.setAttribute("data-hidden","false"):this.setAttribute("data-hidden","true")}}),e(this,"getSetting",()=>this.getState("priceType")),e(this,"getShopLocale",()=>this.getState("locale")),e(this,"getShopCurrency",()=>this.getState("currency")),e(this,"getPriceText",e=>{var t,i;let r=null==e?void 0:e.price,c=null!==(t=null==e?void 0:e.compare_at_price)&&void 0!==t?t:0,a="regular"===this.priceType?null!=r?r:0:null!=c?c:0,n=window.Shopify.formatMoney(`${a}`,null!==(i=this.moneyFormat)&&void 0!==i?i:"${{amount}}");return 0===a&&"compare"===this.priceType?"":`${n}`}),e(this,"displayPriceWhenVariantIsNull",()=>{var e;this.checkHiddenComparePrice(null);let t=window.Shopify.formatMoney("0",null!==(e=this.moneyFormat)&&void 0!==e?e:"${{amount}}"),i=this.querySelector(`#p-price-${this.uid} .gp-price`);i&&(i.innerHTML=t)}),this.uid=this.getState("uid"),this.priceType=null!==(t=this.getSetting())&&void 0!==t?t:"regular",this.isComparePrice="compare"===this.priceType,this.moneyFormat=this.getState("moneyFormat");let i=this.getContext("variantSelected");if(i){let e=this.getPriceText(i),t=this.querySelector(`#p-price-${this.uid} .gp-price`);t&&(t.innerHTML=e)}else this.displayPriceWhenVariantIsNull();this.subscribeContext((e,t)=>{var i,r;if(!e.variantSelected){this.displayPriceWhenVariantIsNull();return}(null===(i=e.variantSelected)||void 0===i?void 0:i.id)!==(null===(r=t.variantSelected)||void 0===r?void 0:r.id)&&(this.checkHiddenComparePrice(e.variantSelected),e.variantSelected&&this.changeDisplayPrice(e.variantSelected))})}}customElements.get("gp-product-price")||customElements.define("gp-product-price",t)}();
