1class AlgoliaPrice extends HTMLElement{constructor(){super(),this.connectedCallback=this.connectedCallback.bind(this),this.isSalePricing=this.isSalePricing.bind(this),this.render=this.render.bind(this)}connectedCallback(){this.settings={fromPriceHtml:this.getAttribute("from-price-html"),priceRangeHtml:this.getAttribute("price-range-html"),id:this.getAttribute("id"),msrpPrice:this.getAttribute("msrp-price"),onSale:this.getAttribute("on-sale"),priceClass:this.getAttribute("price-class"),priceClassMsrp:this.getAttribute("price-class-msrp"),priceClassRegular:this.getAttribute("price-class-regular"),priceClassSale:this.getAttribute("price-class-sale"),regularPrice:this.getAttribute("regular-price"),saleBadgeColorScheme:this.getAttribute("sale-badge-color-scheme"),salePrice:this.getAttribute("sale-price"),showBadges:this.getAttribute("show-badges").toLowerCase()==="true",showMsrp:this.getAttribute("show-msrp").toLowerCase()==="true",showPrice:this.getAttribute("show-price").toLowerCase()==="true",soldOut:this.getAttribute("sold-out"),soldOutBadgeColorScheme:this.getAttribute("sold-out-badge-color-scheme"),strikeMsrp:this.getAttribute("strike-msrp").toLowerCase()==="true",yAdjustedMap:this.getAttribute("y-adjusted-map")}}isSalePricing(item){try{const markdownReason=item?.meta["trove-facets"]?.markdownReason||[];return JSON.parse(this.settings.yAdjustedMap).some(adjustedMap=>markdownReason.includes(adjustedMap.yadjusted_code))}catch{return!1}}render(item){const troveFacets=item?.meta["trove-facets"],msrpPrice=item?.meta["trove-pricing"]?.msrp_price,isMixedStyles=(troveFacets?.catalogItemType?.toString()||"").includes("OPEN_SKU"),price=item.price*100,priceMin=item.variants_min_price*100,priceMax=item.variants_max_price*100,priceVaries=priceMin!==priceMax,compareAtPrice=msrpPrice||price,compareAtPriceMin=item.variants_compare_at_price_min,compareAtPriceMax=item.variants_compare_at_price_max,compareAtPriceVaries=compareAtPriceMin!==compareAtPriceMax,formattedPrice=formatMoney(price),formattedPriceMin=formatMoney(priceMin),formattedPriceMax=formatMoney(priceMax),formattedCompareAtPrice=msrpPrice?formatMoney(msrpPrice):formattedPrice,formattedFromPriceHtml=this.settings.fromPriceHtml.replace("min_price",formattedPriceMin).replace("max_price",formattedPriceMax),formattedMoneyPrice=priceVaries?formattedFromPriceHtml:formattedPrice,salePricing=this.isSalePricing(item),priceWrapperDiv=document.createElement("div");priceWrapperDiv.classList.add("price"),this.settings.priceClass&&priceWrapperDiv.classList.add(this.settings.priceClass),!priceVaries&&compareAtPriceVaries&&priceWrapperDiv.classList.add("price--no-compare"),this.settings.showBadges&&priceWrapperDiv.classList.add("price--show-badge"),salePricing&&priceWrapperDiv.classList.add("price--on-sale");const priceContainerDiv=document.createElement("div");priceContainerDiv.classList.add("price__container"),priceWrapperDiv.appendChild(priceContainerDiv);const priceCurrentDiv=document.createElement("div");salePricing&&priceCurrentDiv.classList.add("price__sale"),priceCurrentDiv.classList.add("price__current"),priceContainerDiv.appendChild(priceCurrentDiv);const priceItemCurrentSpan=document.createElement("span");priceItemCurrentSpan.classList.add("price-item--current"),salePricing&&this.settings.priceClassSale?priceItemCurrentSpan.classList.add(this.settings.priceClassSale,"price-item--sale"):this.settings.priceClassRegular&&priceItemCurrentSpan.classList.add(this.settings.priceClassRegular),priceCurrentDiv.appendChild(priceItemCurrentSpan);const price1stSpan=document.createElement("span");salePricing||(price1stSpan.textContent=this.settings.regularPrice,priceItemCurrentSpan.appendChild(price1stSpan));const price2ndSpan=document.createElement("span");price2ndSpan.classList.add("price-item"),priceVaries&&(price2ndSpan.classList.add("price-item--range"),price2ndSpan.ariaHidden=!0),priceItemCurrentSpan.appendChild(price2ndSpan);const price3rdSpan=document.createElement("span");if(price3rdSpan.classList.add("price-item"),price3rdSpan.id=`price-item-${item.id}`,price3rdSpan.textContent=this.settings.showPrice?` ${formattedMoneyPrice}`:"",price2ndSpan.appendChild(price3rdSpan),priceVaries){const screenReaderPriceSpan=document.createElement("span");screenReaderPriceSpan.classList.add("visually-hidden"),screenReaderPriceSpan.textContent=this.settings.priceRangeHtml.replace("min_price",formattedPriceMin).replace("max_price",formattedPriceMax),price2ndSpan.appendChild(screenReaderPriceSpan)}const msrpPriceSpan=document.createElement("span");msrpPriceSpan.classList.add("price-item--msrp"),this.settings.priceClassMsrp&&msrpPriceSpan.classList.add(this.settings.priceClassMsrp),(!this.settings.showMsrp||compareAtPrice<=price||isMixedStyles)&&msrpPriceSpan.classList.add("hidden"),this.settings.strikeMsrp&&msrpPriceSpan.classList.add("p-strikethrough"),msrpPriceSpan.id=`compare-at-price-container-${item.id}`;const msrpPrice2ndSpan=document.createElement("span");msrpPrice2ndSpan.textContent=this.settings.msrpPrice,msrpPriceSpan.appendChild(msrpPrice2ndSpan);const msrpPrice3rdSpan=document.createElement("span");if(msrpPrice3rdSpan.classList.add("price-item"),msrpPrice3rdSpan.id=`compare-at-price-item-${item.id}`,msrpPrice3rdSpan.textContent=` ${formattedCompareAtPrice}`,msrpPriceSpan.appendChild(msrpPrice3rdSpan),priceCurrentDiv.appendChild(msrpPriceSpan),this.settings.showBadges){const badgeSaleSpan=document.createElement("span");
1badgeSaleSpan.classList.add("badge","price__badge-sale",`color-${this.settings.saleBadgeColorScheme}`),badgeSaleSpan.textContent=this.settings.onSale,priceWrapperDiv.appendChild(badgeSaleSpan);const badgeSoldOutSpan=document.createElement("span");badgeSoldOutSpan.classList.add("badge","price__badge-sold-out",`color-${this.settings.soldOutBadgeColorScheme}`),badgeSoldOutSpan.textContent=this.settings.soldOut,priceWrapperDiv.appendChild(badgeSoldOutSpan)}return priceWrapperDiv}}customElements.define("algolia-price",AlgoliaPrice); 2//# sourceMappingURL=/cdn/shop/t/223/assets/algolia-price.js.map?v=24829446732239974231789498267
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.