1class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",event=>{event.preventDefault();const cartItems=this.closest("cart-items")||this.closest("cart-drawer-items");cartItems&&cartItems.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.currentItemCount=Array.from(this.querySelectorAll('[name="updates[]"]')).reduce((total,quantityInput)=>total+parseInt(quantityInput.value||"0",10),0),this.debouncedOnChange=debounce(event=>{this.onChange(event)},300),this.addEventListener("change",this.debouncedOnChange.bind(this))}onChange(event){const idx=event.target?.dataset?.index,val=event.target?.value,activeName=document.activeElement?document.activeElement.getAttribute("name"):null;this.updateQuantity(idx,val,activeName)}getSectionsToRender(){const mainItems=document.getElementById("main-cart-items"),mainFooter=document.getElementById("main-cart-footer");return[mainItems?{id:"main-cart-items",section:mainItems.dataset.id,selector:".js-contents"}:null,{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"cart-live-region-text",section:"cart-live-region-text",selector:".shopify-section"},mainFooter?{id:"main-cart-footer",section:mainFooter.dataset.id,selector:".js-contents"}:null].filter(Boolean)}updateQuantity(line,quantity,name){if(!line)return;this.enableLoading(line);const body=JSON.stringify({line,quantity,sections:this.getSectionsToRender().map(s=>s.section),sections_url:window.location.pathname});fetch(`${routes.cart_change_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);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=>{const host=document.getElementById(section.id).querySelector(section.selector)||document.getElementById(section.id);host.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector)}),this.updateLiveRegions(line,parsedState.item_count);const lineItem=document.getElementById(`CartItem-${line}`)||document.getElementById(`CartDrawer-Item-${line}`);if(lineItem&&name){const focusable=lineItem.querySelector(`[name="${name}"]`);if(focusable){const cartDrawerWrapperNow=document.querySelector("cart-drawer");cartDrawerWrapperNow?trapFocus(cartDrawerWrapperNow,focusable):focusable.focus()}}else{const cartDrawerWrapperNow=document.querySelector("cart-drawer");if(parsedState.item_count===0&&cartDrawerWrapperNow){const emptyContainer=cartDrawerWrapperNow.querySelector(".drawer__inner-empty"),firstLink=emptyContainer?emptyContainer.querySelector("a"):null;emptyContainer&&firstLink&&trapFocus(emptyContainer,firstLink)}else if(document.querySelector(".cart-item")&&cartDrawerWrapperNow){const firstName=document.querySelector(".cart-item__name");firstName&&trapFocus(cartDrawerWrapperNow,firstName)}}this.disableLoading()}).catch(()=>{this.querySelectorAll(".loading-overlay").forEach(overlay=>overlay.classList.add("hidden"));const errors=document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors");errors&&(errors.textContent=window.cartStrings.error),this.disableLoading()})}updateLiveRegions(line,itemCount){if(this.currentItemCount===itemCount){const lineItemError=document.getElementById(`Line-item-error-${line}`)||document.getElementById(`CartDrawer-LineItemError-${line}`),quantityElement=document.getElementById(`Quantity-${line}`)||document.getElementById(`Drawer-quantity-${line}`);if(lineItemError&&quantityElement){const msg=window.cartStrings.quantityError.replace("[quantity]",quantityElement.value),holder=lineItemError.querySelector(".cart-item__error-text");holder&&(holder.innerHTML=msg)}}this.currentItemCount=itemCount,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){const el=new DOMParser().parseFromString(html,"text/html").querySelector(selector);return el?el.innerHTML:""}enableLoading(line){const mainCartItems=document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems");mainCartItems&&mainCartItems.classList.add("cart__items--disabled");const cartItemEls=this.querySelectorAll(`#CartItem-${line} .loading-overlay`),cartDrawerEls=this.querySelectorAll(`#CartDrawer-Item-${line} .loading-overlay`);[...cartItemEls,...cartDrawerEls].forEach(overlay=>overlay.classList.remove("hidden")),document.activeElement&&document.activeElement.blur(),this.lineItemStatusElement&&this.lineItemStatusElement.setAttribute("aria-hidden",!1)}disableLoading(){const mainCartItems=document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems");mainCartItems&&mainCartItems.classList.remove("cart__items--disabled")}}customElements.define("cart-items",CartItems),window.CartItems=CartItems,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))}}); 2//# sourceMappingURL=/cdn/shop/t/334/assets/cart.js.map?v=142731495522133036661790871634
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.