1class CartCount extends HTMLElement{constructor(){super()}connectedCallback(){window.addEventListener("cart:changed",this.update.bind(this)),window.addEventListener("cart:add",this.increment.bind(this))}update(e){typeof e.detail?.item_count=="number"&&(this.innerHTML=`${e.detail.item_count}`,this.hidden=e.detail.item_count===0)}increment(e){e.detail.added_count&&(this.innerHTML=`${parseInt(this.innerHTML)+e.detail.added_count}`,this.hidden=!1)}}customElements.define("cart-count",CartCount);class CartDrawer extends Popup{constructor(){super()}connectedCallback(){super.connectedCallback(),window.addEventListener("cart:add",this.open.bind(this)),this.updateLineItemsHeight()}open(e){typeof AtcSuccessModal<"u"&&AtcSuccessModal.matches(e?.detail)||(super.open(),window.requestAnimationFrame(this.frame.bind(this)))}close(){super.close()}frame(){this.updateLineItemsHeight(),super.isOpen()&&window.requestAnimationFrame(this.frame.bind(this))}updateLineItemsHeight(){const upper=this.querySelector("[data-cart-drawer-upper]")?.getBoundingClientRect().height??0,header=this.querySelector("[data-cart-drawer-header]")?.getBoundingClientRect().height??0,upsell=this.querySelector("[data-cart-drawer-upsell]")?.getBoundingClientRect().height??0,footer=this.querySelector("[data-cart-drawer-footer]")?.getBoundingClientRect().height??0,items=this.querySelector("[data-cart-drawer-items]"),combinedHeightOfOtherElements=upper+header+footer;items.style.maxHeight=window.innerHeight-combinedHeightOfOtherElements+"px"}}customElements.define("cart-drawer",CartDrawer);class CartForm extends HTMLElement{constructor(){super()}connectedCallback(){const quantities=this.querySelectorAll('[name="updates[]"]'),removeButtons=this.querySelectorAll('[name="line-item-remove"]');quantities.forEach(qty=>{qty.addEventListener("change",e=>{this.loading=!0,this.updateCart({[qty.dataset.lineItemKey]:Number(qty.value)}).then(res=>{this.updateView(res.sections[this.section]),this.loading=!1})})}),removeButtons.forEach(rm=>{rm.addEventListener("click",e=>{e.preventDefault(),this.removeByUrl(rm.href)})}),window.addEventListener("cart:add",e=>{this.loading=!0,this.updateView(e.detail?.sections[this.section]),this.loading=!1})}get section(){return this.getAttribute("section")||"cart-main"}removeByUrl(href){this.loading=!0;const url=new URL(href);url.searchParams.append("sections",this.section),fetch(`${url}`,{headers:{Accept:"application/json"}}).then(res=>res.json()).then(res=>{window.dispatchEvent(new CustomEvent("cart:changed",{detail:{...res}})),this.updateView(res.sections[this.section]),this.loading=!1}).catch(err=>{console.error(err),this.loading=!1})}updateView(htmlString){const div=document.createElement("div");div.innerHTML=htmlString.trim();const newForm=div.querySelector("cart-form");this.replaceWith(newForm),window.dispatchEvent(new CustomEvent("cart:updated")),console.log("Cart updated")}async updateCart(updates){return new Promise(resolve=>{Shopify.theme.cart.updateCart({updates},!0,resolve)})}set loading(v){v?this.setAttribute("loading",v):this.removeAttribute("loading")}get loading(){return this.hasAttribute("loading")}static get observedAttributes(){return[]}attributeChangedCallback(property,oldValue,newValue){oldValue!==newValue&&(this[property]=newValue)}}customElements.define("cart-form",CartForm); 2//# sourceMappingURL=/cdn/shop/t/676/assets/cart-components.js.map?v=153784774345083165531787208574
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.