1document.addEventListener("cart:itemsAdded",event=>{const{items,source}=event.detail;source==="product-page"&&(window.lastAddedItems=Array.isArray(items)?items:[items],window.lastAddedSource=source)});class CartDrawer extends HTMLElement{constructor(){super(),this.addEventListener("keyup",evt=>evt.code==="Escape"&&this.close()),this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this._observer=new MutationObserver(()=>this._markNewItemsAfterPaint()),this._attachObserver()}open(triggeredBy){triggeredBy&&this.setActiveElement(triggeredBy);const cartDrawerNote=this.querySelector('[id^="Details-"] summary');cartDrawerNote&&!cartDrawerNote.hasAttribute("role")&&this.setSummaryAccessibility(cartDrawerNote),setTimeout(()=>{this.classList.add("animate","active")}),this.addEventListener("transitionend",()=>{const containerToTrapFocusOn=this.classList.contains("is-empty")?this.querySelector(".drawer__inner-empty"):document.getElementById("CartDrawer"),focusElement=this.querySelector(".drawer__inner")||this.querySelector(".drawer__close");trapFocus(containerToTrapFocusOn,focusElement)},{once:!0}),document.body.classList.add("overflow-hidden"),window.cartShipping(),this._markNewItemsAfterPaint()}close(){this.classList.remove("active"),removeTrapFocus(this.activeElement),document.body.classList.remove("overflow-hidden")}setSummaryAccessibility(cartDrawerNote){cartDrawerNote.setAttribute("role","button"),cartDrawerNote.setAttribute("aria-expanded","false"),cartDrawerNote.nextElementSibling.getAttribute("id")&&cartDrawerNote.setAttribute("aria-controls",cartDrawerNote.nextElementSibling.id),cartDrawerNote.addEventListener("click",event=>{event.currentTarget.setAttribute("aria-expanded",!event.currentTarget.closest("details").hasAttribute("open"))}),cartDrawerNote.parentElement.addEventListener("keyup",onKeyUpEscape)}renderContents(parsedState){this.querySelector(".drawer__inner").classList.contains("is-empty")&&this.querySelector(".drawer__inner").classList.remove("is-empty"),this.productId=parsedState.id,this.getSectionsToRender().forEach(section=>{const sectionElement=section.selector?document.querySelector(section.selector):document.getElementById(section.id);sectionElement&&(sectionElement.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.id],section.selector))}),this._attachObserver(),this._markNewItemsAfterPaint(),setTimeout(()=>{this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this.open()})}getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}getSectionsToRender(){return[{id:"cart-drawer",selector:"#CartDrawer"},{id:"cart-icon-bubble"}]}getSectionDOM(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector)}setActiveElement(element){this.activeElement=element}_attachObserver(){const inner=this.querySelector(".drawer__inner");!inner||!this._observer||(this._observer.disconnect(),this._observer.observe(inner,{childList:!0,subtree:!0}))}_markNewItemsAfterPaint(){if(window.lastAddedSource==="accessory"||!["product-page","bundle"].includes(window.lastAddedSource)||!window.lastAddedItems||!window.lastAddedItems.length)return;const items=window.lastAddedItems,total=items.length;let markedCount=0;items.forEach((item,index)=>{const node=document.querySelector(`#CartDrawer-Item-${item.id}`);if(node){node.classList.add("is-new");const orderValue=index;node.style.order=orderValue,markedCount++}}),markedCount>0||this._hasAnyNewItems()||this.close()}_hasAnyNewItems(){return!!this.querySelector('[id^="CartDrawer-Item-"].is-new, .cart-item-wrapper.is-new, .cart-item.is-new')}}customElements.define("cart-drawer",CartDrawer);class CartDrawerItems extends CartItems{getSectionsToRender(){return[{id:"CartDrawer",section:"cart-drawer",selector:".drawer__inner"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"}]}}customElements.define("cart-drawer-items",CartDrawerItems); 2//# sourceMappingURL=/cdn/shop/t/61/assets/cart-drawer.js.map?v=176277936786282072981790955730
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.