class Badges extends HTMLElement{constructor(){super(),this.tags=this.dataset.tags.split(","),this.addDummyCustomTags(),this.initBadges()}buildStyles(tag){return`style = "background-color: ${tag.backgroundColor}; color: ${tag.textColor}"`}addDummyCustomTags(){if(!window.badges)return;const{compareAtPrice,price,available}=this.dataset;this.addSaleTag(compareAtPrice,price),this.addSoldOutTag(available)}addSaleTag(compareAtPrice,price){for(const tag of this.tags)tag.toLowerCase().indexOf("sale:")>-1&&this.tags.push(window.badges.config.saleDummyTag);typeof compareAtPrice>"u"||!compareAtPrice||typeof price>"u"||compareAtPrice>price&&this.tags.push(window.badges.config.saleDummyTag)}addSoldOutTag(available){if(typeof available>"u")return;available==="true"||this.tags.push(window.badges.config.soldOutDummyTag)}initBadges(){if(!window.badges)return;var positions={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[]};for(const badge of window.badges.list)if(this.tags.includes(badge.tag)){let html=`