1import{Component}from"@theme/component";import{StandardEvents}from"@shopify/events";import{DrawerOpenEvent}from"@theme/theme-drawer";class CartDrawerComponent extends Component{#summaryThreshold=.5;get#themeDrawer(){return this.closest("theme-drawer")}get#dialog(){return this.closest("dialog")}connectedCallback(){super.connectedCallback(),document.addEventListener(StandardEvents.cartLinesUpdate,this.#handleCartLinesUpdate),this.#themeDrawer?.addEventListener(DrawerOpenEvent.eventName,this.#handleDrawerOpen),this.#themeDrawer?.hasAttribute("open")&&this.#handleDrawerOpen()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(StandardEvents.cartLinesUpdate,this.#handleCartLinesUpdate),this.#themeDrawer?.removeEventListener(DrawerOpenEvent.eventName,this.#handleDrawerOpen)}#handleDrawerOpen=()=>{this.#updateStickyState(),customElements.whenDefined("shopify-payment-terms").then(()=>{this.querySelector("shopify-payment-terms")?.shadowRoot?.querySelector("#shopify-installments-cta")?.addEventListener("click",()=>this.#themeDrawer?.close(),{once:!0})})};#handleCartLinesUpdate=event=>{const shouldAutoOpen=this.hasAttribute("auto-open")&&event.action==="add"&&!this.#themeDrawer?.isOpen,sourceModal=event.target instanceof Element?event.target.closest("dialog:modal"):null;shouldAutoOpen&&!sourceModal&&!this.#isCartEmpty()&&this.#themeDrawer?.open(),event.promise?.then(({detail})=>{const settle=()=>requestAnimationFrame(()=>this.#updateStickyState());if(!shouldAutoOpen||detail?.didError){settle();return}const openAndSettle=()=>{this.#themeDrawer?.isOpen||this.#themeDrawer?.open(),settle()};sourceModal?.open?sourceModal.addEventListener("close",openAndSettle,{once:!0}):openAndSettle()}).catch(error=>{error?.name!=="AbortError"&&console.warn("[cart-drawer] Event promise rejected:",error)})};#isCartEmpty(){return!!this.querySelector(".cart-drawer--empty")}#updateStickyState(){const dialog=this.#dialog;if(!dialog)return;const content=dialog.querySelector(".cart-drawer__content"),summary=dialog.querySelector(".cart-drawer__summary");if(!content||!summary){dialog.setAttribute("cart-summary-sticky","false");return}const drawerHeight=dialog.getBoundingClientRect().height,ratio=summary.getBoundingClientRect().height/drawerHeight;dialog.setAttribute("cart-summary-sticky",ratio>this.#summaryThreshold?"false":"true")}}customElements.get("cart-drawer-component")||customElements.define("cart-drawer-component",CartDrawerComponent); 2//# sourceMappingURL=/cdn/shop/t/4/assets/cart-drawer.js.map?v=101430053943909765251784931096
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.