1class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",event=>{event.preventDefault(),(this.closest("cart-items")||this.closest("cart-drawer-items")).updateQuantity(this.dataset.index,0)})}}customElements.define("cart-remove-button",CartRemoveButton);class CartItems extends HTMLElement{constructor(){super(),this.lineItemStatusElement=document.getElementById("shopping-cart-line-item-status")||document.getElementById("CartDrawer-LineItemStatus"),this.debouncedOnChange=debounce(event=>{this.onChange(event)},300),this.addEventListener("change",this.debouncedOnChange.bind(this))}cartUpdateUnsubscriber=void 0;connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,event=>{event.source!=="cart-items"&&this.onCartUpdate()})}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}onChange(event){this.updateQuantity(event.target.dataset.index,event.target.value,document.activeElement.getAttribute("name"))}onCartUpdate(){fetch(`${routes.cart_url}?section_id=main-cart`).then(response=>response.text()).then(responseText=>{const sourceQty=new DOMParser().parseFromString(responseText,"text/html").querySelector("cart-items");this.innerHTML=sourceQty.innerHTML}).catch(e=>{console.error(e)})}getSectionsToRender(){let arraySections=[];return window.innerWidth>920&&document.querySelector(".header-without-sidebars")?arraySections=[{id:"main-cart",section:document.getElementById("main-cart").dataset.id,selector:"shopify-section"},{id:"cart-icon-bubble-header",section:"header",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-menu-drawer",section:"menu-drawer",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-secondary-sidebar",section:"secondary-sidebar",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-main-sidebar",section:"main-sidebar",selector:".cart-icon-bubble-count"}]:window.innerWidth>920&&document.querySelector(".secondary-header-section")?arraySections=[{id:"main-cart",section:document.getElementById("main-cart").dataset.id,selector:"shopify-section"},{id:"cart-icon-bubble-secondary-header",section:"secondary-header",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-menu-drawer",section:"menu-drawer",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-secondary-sidebar",section:"secondary-sidebar",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-main-sidebar",section:"main-sidebar",selector:".cart-icon-bubble-count"}]:arraySections=[{id:"main-cart",section:document.getElementById("main-cart").dataset.id,selector:"shopify-section"},{id:"cart-icon-bubble-menu-drawer",section:"menu-drawer",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-mobile-header",section:"mobile-header",selector:".cart-icon-bubble-count"}],arraySections}updateQuantity(line,quantity,name){this.enableLoading(line);const body=JSON.stringify({line,quantity,sections:this.getSectionsToRender().map(section=>section.section),sections_url:window.location.pathname});fetch(`${routes.cart_change_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state),quantityElement=document.getElementById(`Quantity-${line}`)||document.getElementById(`Drawer-quantity-${line}`),items=document.querySelectorAll(".cart-item");if(parsedState.errors){quantityElement.value=quantityElement.getAttribute("value"),this.updateLiveRegions(line,parsedState.errors);return}this.classList.toggle("is-empty",parsedState.item_count===0);const cartDrawerWrapper=document.querySelector("cart-drawer"),cartFooter=document.getElementById("main-cart-footer");cartFooter&&cartFooter.classList.toggle("is-empty",parsedState.item_count===0),cartDrawerWrapper&&cartDrawerWrapper.classList.toggle("is-empty",parsedState.item_count===0),this.get
1SectionsToRender().forEach((section=>{if(document.querySelectorAll(`#${section.id}`)){const elementsToCart=document.querySelectorAll(`#${section.id}`);Array.from(elementsToCart).forEach(element=>{element.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],`#${section.id}`)})}}));const updatedValue=parsedState.items[line-1]?parsedState.items[line-1].quantity:void 0;let message="";items.length===parsedState.items.length&&updatedValue!==parseInt(quantityElement.value)&&(typeof updatedValue>"u"?message=window.cartStrings.error:message=window.cartStrings.quantityError.replace("[quantity]",updatedValue)),this.updateLiveRegions(line,message);const lineItem=document.getElementById(`CartItem-${line}`)||document.getElementById(`CartDrawer-Item-${line}`);lineItem&&lineItem.querySelector(`[name="${name}"]`)?cartDrawerWrapper?trapFocus(cartDrawerWrapper,lineItem.querySelector(`[name="${name}"]`)):lineItem.querySelector(`[name="${name}"]`).focus():parsedState.item_count===0&&cartDrawerWrapper?trapFocus(cartDrawerWrapper.querySelector(".drawer__inner-empty"),cartDrawerWrapper.querySelector("a")):document.querySelector(".cart-item")&&cartDrawerWrapper&&trapFocus(cartDrawerWrapper,document.querySelector(".cart-item__name")),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items"}),this.disableLoading(line),document.dispatchEvent(new CustomEvent("cart:updated",{detail:{cart:state}}))}).catch(()=>{this.querySelectorAll(".loading-overlay__spinner").forEach(overlay=>overlay.classList.add("hidden"));const errors=document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors");errors&&(errors.textContent=window.cartStrings.error,errors.style.marginTop="16px")}).finally(()=>{this.disableLoading(line)})}updateLiveRegions(line,message){const lineItemError=document.getElementById(`Line-item-error-${line}`)||document.getElementById(`CartDrawer-LineItemError-${line}`);lineItemError&&(lineItemError.querySelector(".cart-item__error-text").innerHTML=message),this.lineItemStatusElement&&this.lineItemStatusElement.setAttribute("aria-hidden",!0);const cartStatus=document.getElementById("cart-live-region-text")||document.getElementById("CartDrawer-LiveRegionText");cartStatus&&(cartStatus.setAttribute("aria-hidden",!1),setTimeout(()=>cartStatus.setAttribute("aria-hidden",!0),1e3))}getSectionInnerHTML(html,selector){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}enableLoading(line){const cartItemElements=this.querySelectorAll(`#CartItem-${line} .loading-overlay__spinner`),cartDrawerItemElements=this.querySelectorAll(`#CartDrawer-Item-${line} .loading-overlay__spinner`);
1[...cartItemElements,...cartDrawerItemElements].forEach(overlay=>overlay.classList.remove("hidden")),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1)}disableLoading(line){const cartItemElements=this.querySelectorAll(`#CartItem-${line} .loading-overlay__spinner`),cartDrawerItemElements=this.querySelectorAll(`#CartDrawer-Item-${line} .loading-overlay__spinner`);cartItemElements.forEach(overlay=>overlay.classList.add("hidden")),cartDrawerItemElements.forEach(overlay=>overlay.classList.add("hidden"))}}customElements.define("cart-items",CartItems);class CartDrawerItems extends CartItems{getSectionsToRender(){let arraySections=[];return window.innerWidth>920&&document.querySelector(".header-without-sidebars")?arraySections=[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"},{id:"cart-icon-bubble-header",section:"header",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-menu-drawer",section:"menu-drawer",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-secondary-sidebar",section:"secondary-sidebar",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-main-sidebar",section:"main-sidebar",selector:".cart-icon-bubble-count"}]:window.innerWidth>920&&document.querySelector(".secondary-header-section")?arraySections=[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"},{id:"cart-icon-bubble-secondary-header",section:"secondary-header",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-menu-drawer",section:"menu-drawer",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-secondary-sidebar",section:"secondary-sidebar",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-main-sidebar",section:"main-sidebar",selector:".cart-icon-bubble-count"}]:arraySections=[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"},{id:"cart-icon-bubble-menu-drawer",section:"menu-drawer",selector:".cart-icon-bubble-count"},{id:"cart-icon-bubble-mobile-header",section:"mobile-header",selector:".cart-icon-bubble-count"}],arraySections}}customElements.define("cart-drawer-items",CartDrawerItems),customElements.get("cart-note")||customElements.define("cart-note",class extends HTMLElement{constructor(){super(),this.addEventListener("change",debounce(event=>{const body=JSON.stringify({note:event.target.value});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body})},300))}});class ShippingCalculator extends HTMLElement{constructor(){super(),this.setupCountries(),this.errors=this.querySelector("#ShippingCalculatorErrors"),this.success=this.querySelector("#ShippingCalculatorSuccess"),this.zip=this.querySelector("#ShippingCalculatorZip"),this.country=this.querySelector("#ShippingCalculatorCountry"),this.province=this.querySelector("#ShippingCalculatorProvince"),this.button=this.querySelector("button"),this.button.addEventListener("click",this.onSubmitHandler.bind(this))}setupCountries(){Shopify&&Shopify.CountryProvinceSelector&&new Shopify.CountryProvinceSelector("ShippingCalculatorCountry","ShippingCalculatorProvince",{hideElement:"ShippingCalculatorProvinceContainer"})}onSubmitHandler(event){event.preventDefault(),this.errors.classList.add("hidden"),this.success.classList.add("hidden"),this.zip.classList.remove("invalid"),this.country.classList.remove("invalid"),this.province.classList.remove("invalid"),this.button.classList.add("loading"),this.button.setAttribute("disabled",!0);const body=JSON.stringify({shipping_address:{zip:this.zip.value,country:this.country.value,province:this.province.value}});let sectionUrl=`${routes.cart_url}/shipping_rates.json`;sectionUrl=sectionUrl.replace("//","/"),fetch(sectionUrl,{...fetchConfig("javascript"),body}).then(response=>response.json()).then(parsedState=>{if(parsedState.shipping_rates)this.success.classList.remove("hidden"),this.success.innerHTML="",parsedState.shipping_rates.forEac
1h(rate=>{const child=document.createElement("p");child.innerHTML=`${rate.name}: ${rate.price} ${Shopify.currency.active}`,this.success.appendChild(child)});else{let errors=[];Object.entries(parsedState).forEach(([attribute,messages])=>{errors.push(messages[0])}),this.errors.classList.remove("hidden"),this.errors.querySelector(".errors").innerHTML=errors.join("; ")}}).catch(e=>{console.error(e)}).finally(()=>{this.button.classList.remove("loading"),this.button.removeAttribute("disabled"),this.closest(".accordion__panel")&&(this.closest(".accordion__panel").style.maxHeight=this.closest(".accordion__content").offsetHeight+"px")})}}customElements.define("shipping-calculator",ShippingCalculator); 2//# sourceMappingURL=/cdn/shop/t/3/assets/cart.js.map?v=48080857231871157601711529028
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.