(()=>{if(customElements.get("cookie-banner"))return;class CookieBanner extends HTMLElement{constructor(){super(),this.activeClass="is-visible",this.actionsSelector="[data-action]",this.actions=this.querySelectorAll(this.actionsSelector),this.actions?.forEach(action=>{action.addEventListener("click",this.performAction.bind(this))})}connectedCallback(){if(Shopify.designMode&&this.dataset.openInDesignMode==="true"){this.classList.add(this.activeClass);return}this.loadShopifyScript()}loadShopifyScript(){typeof window.Shopify<"u"&&window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],error=>{if(error)throw error;this.initBanner()})}initBanner(){window.Shopify.customerPrivacy.getTrackingConsent()==="no_interaction"&&this.classList.add(this.activeClass)}performAction(event){if(event.preventDefault(),this.dataset.openInDesignMode==="true"){this.classList.remove(this.activeClass);return}const action=event.target.getAttribute("id")!==null?event.target.getAttribute("id"):event.target.parentElement.getAttribute("id");action&&window.Shopify.customerPrivacy.setTrackingConsent(action==="accept-cookies",()=>{this.classList.remove(this.activeClass)})}}customElements.define("cookie-banner",CookieBanner)})();
//# sourceMappingURL=/cdn/shop/t/12/assets/cookie-banner.js.map?v=44863611379243583801682758930
