1const DESKTOP_MEDIA_QUERY="(min-width: 1201px)",PINNED_ATTRIBUTE_KEY="_cart_drawer_pinned";class CartDrawerSidebar{constructor(cartDrawerConfig2){this.html=document.documentElement,this.desktopMediaQuery=window.matchMedia(DESKTOP_MEDIA_QUERY),this.pinLabel=cartDrawerConfig2.dataset.cartDrawerPinLabel||"",this.unpinLabel=cartDrawerConfig2.dataset.cartDrawerUnpinLabel||"",this.isPinned=cartDrawerConfig2.dataset.cartDrawerPinned==="true",this.cartReplacementToken=0,this.cartReplacementInProgress=!1,this.cartReplacementObserver=void 0,this.cartReplacementTimeout=void 0,this.isOpeningReplacementCart=!1,this.cartRevealToken=0,this.cartRevealFrame=void 0,this.cartRevealAddedNoTransition=!1,this.pushCloseCleanup=void 0,this.syncButtons=this.syncButtons.bind(this),this.handleClick=this.handleClick.bind(this),this.handleDrawerToggle=this.handleDrawerToggle.bind(this),this.handleMediaChange=this.handleMediaChange.bind(this),this.setPinned(this.isPinned,!1),this.html.addEventListener("wetheme-toggle-right-drawer",this.handleDrawerToggle,!0),this.html.addEventListener("wetheme-cart-update",()=>{window.requestAnimationFrame(this.syncButtons)}),document.addEventListener("click",this.handleClick,!0),this.desktopMediaQuery.addEventListener?this.desktopMediaQuery.addEventListener("change",this.handleMediaChange):this.desktopMediaQuery.addListener&&this.desktopMediaQuery.addListener(this.handleMediaChange)}isDesktop(){return this.desktopMediaQuery.matches}isDrawerOpen(){return document.body.classList.contains("js-drawer-open-right")}getCartDrawer(){return document.querySelector(".right-drawer-vue .drawer.is--cart")}hasCartDrawer(){return!!this.getCartDrawer()}isCartDrawerOpen(){return!!document.querySelector(".right-drawer-vue .drawer.is--cart:not(.drawer-right-leave):not(.drawer-right-leave-active):not(.drawer-right-leave-to)")}hasFemtisSidebar(){return!!document.querySelector(".f-sidebar-panel")}getShopifyRoot(){return window.Shopify&&window.Shopify.routes&&window.Shopify.routes.root||"/"}persistPinned(value){try{window.fetch(this.getShopifyRoot()+"cart/update.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:{[PINNED_ATTRIBUTE_KEY]:value}}),keepalive:!0}).catch(()=>{})}catch{}}syncButtons(){document.querySelectorAll("[data-cart-drawer-pin]").forEach(button=>{button.setAttribute("aria-pressed",String(this.isPinned)),button.setAttribute("aria-label",this.isPinned?this.unpinLabel:this.pinLabel)})}clearPushCloseWait(){if(this.pushCloseCleanup){const cleanup=this.pushCloseCleanup;this.pushCloseCleanup=void 0,cleanup()}}waitForPushClose(){const cartDrawer=this.getCartDrawer(),drawerRoot=document.querySelector(".right-drawer-vue");if(!cartDrawer||!drawerRoot){this.html.classList.remove("drawer-push-open","drawer-push-closing");return}let disposed=!1;const onTransitionEnd=event=>{event.target===cartDrawer&&event.propertyName==="transform"&&finish()},onTransitionCancel=event=>{event.target===cartDrawer&&event.propertyName==="transform"&&finish()},observer=new MutationObserver(()=>{this.hasCartDrawer()||finish()}),cleanup=()=>{disposed||(disposed=!0,cartDrawer.removeEventListener("transitionend",onTransitionEnd),cartDrawer.removeEventListener("transitioncancel",onTransitionCancel),observer.disconnect(),this.pushCloseCleanup===cleanup&&(this.pushCloseCleanup=void 0))},finish=()=>{this.isDrawerOpen()&&this.isCartDrawerOpen()||(cleanup(),this.html.classList.remove("drawer-push-open","drawer-push-closing"))};this.pushCloseCleanup=cleanup,cartDrawer.addEventListener("transitionend",onTransitionEnd),cartDrawer.addEventListener("transitioncancel",onTransitionCancel),observer.observe(drawerRoot,{childList:!0,subtree:!0})}setPushOpen(open){if(this.clearPushCloseWait(),open&&this.isDesktop()){this.html.classList.remove("drawer-push-closing"),this.html.classList.add("drawer-push-open");return}if(!open&&this.isDesktop()&&(this.html.classList.contains("drawer-push-open")||this.html.classList.contains("drawer-push-closing"))){this.html.classList.remove("drawer-push-open"),this.html.classList.add("drawer
1-push-closing"),this.waitForPushClose();return}this.html.classList.remove("drawer-push-open","drawer-push-closing")}cancelCartReveal(){this.cartRevealToken+=1,this.cartRevealFrame&&(window.cancelAnimationFrame(this.cartRevealFrame),this.cartRevealFrame=void 0),this.html.classList.remove("drawer-push-cart-reveal"),this.cartRevealAddedNoTransition&&(this.html.classList.remove("drawer-no-transition"),this.cartRevealAddedNoTransition=!1)}revealOpenCart(){this.cancelCartReveal();const cartDrawer=this.getCartDrawer();if(!cartDrawer)return;const revealToken=this.cartRevealToken;this.cartRevealAddedNoTransition=!this.html.classList.contains("drawer-no-transition"),this.html.classList.add("drawer-no-transition","drawer-push-cart-reveal"),cartDrawer.getBoundingClientRect(),this.cartRevealFrame=window.requestAnimationFrame(()=>{if(this.cartRevealFrame=void 0,revealToken===this.cartRevealToken){if(!cartDrawer.isConnected){this.cancelCartReveal();return}this.cartRevealAddedNoTransition&&(this.html.classList.remove("drawer-no-transition"),this.cartRevealAddedNoTransition=!1,cartDrawer.getBoundingClientRect()),this.html.classList.remove("drawer-push-cart-reveal")}})}clearCartReplacementWait(){this.cartReplacementObserver&&(this.cartReplacementObserver.disconnect(),this.cartReplacementObserver=void 0),this.cartReplacementTimeout&&(window.clearTimeout(this.cartReplacementTimeout),this.cartReplacementTimeout=void 0)}openCartAfterReplacement(replacementToken){if(!(!this.cartReplacementInProgress||replacementToken!==this.cartReplacementToken)&&!(this.isDrawerOpen()||this.hasCartDrawer())){this.clearCartReplacementWait(),this.cartReplacementInProgress=!1,this.html.classList.remove("drawer-no-transition"),this.isOpeningReplacementCart=!0;try{window.wetheme&&typeof window.wetheme.toggleRightDrawer=="function"&&window.wetheme.toggleRightDrawer("cart",!0)}finally{this.isOpeningReplacementCart=!1}window.setTimeout(()=>{!this.cartReplacementInProgress&&replacementToken===this.cartReplacementToken&&this.html.classList.remove("drawer-push-handoff")},800)}}waitForCartRemoval(replacementToken){this.clearCartReplacementWait();const check=()=>{!this.cartReplacementInProgress||replacementToken!==this.cartReplacementToken||this.isDrawerOpen()||this.hasCartDrawer()||this.openCartAfterReplacement(replacementToken)},drawerRoot=document.querySelector(".right-drawer-vue");drawerRoot&&(this.cartReplacementObserver=new MutationObserver(check),this.cartReplacementObserver.observe(drawerRoot,{childList:!0,subtree:!0})),check(),this.cartReplacementTimeout=window.setTimeout(()=>{if(!(!this.cartReplacementInProgress||replacementToken!==this.cartReplacementToken)){if(this.isDrawerOpen()||this.hasCartDrawer()){this.clearCartReplacementWait(),this.cartReplacementInProgress=!1,this.html.classList.remove("drawer-no-transition","drawer-push-handoff"),this.setPushOpen(!1);return}this.openCartAfterReplacement(replacementToken)}},2e3)}closeFemtisSidebarPanels(){this.html.dispatchEvent(new CustomEvent("femtis-close-sidebar-panels"))}updateCartState(cart){const drawerRoot=document.querySelector(".right-drawer-vue"),vueRoot=drawerRoot&&drawerRoot.__vue__,cartDrawer=vueRoot&&vueRoot.$children?vueRoot.$children.find(component=>component.cart!==void 0):null;cartDrawer&&(cartDrawer.cart=cart,cart.attributes&&cart.attributes.gift_note&&(cartDrawer.giftNote=cart.attributes.gift_note)),window.wetheme&&typeof window.wetheme.updateCartDrawer=="function"&&window.wetheme.updateCartDrawer(cart)}setPinned(next,shouldPersist){this.isPinned=next,this.syncButtons(),shouldPersist&&this.persistPinned(this.isPinned?"true":"")}clearPinned(){this.isPinned&&this.setPinned(!1,!0)}handleClick(event){const element=event.target&&typeof event.target.closest=="function"?event.target:null;if(!element)return;if(element.closest("[data-cart-drawer-pin]")){event.preventDefault(),this.setPinned(!this.isPinned,!0);return}if(!this.isDesktop())return;if(element.closest(".right-drawer-vue .drawer.is--cart .js-drawer-close button")){this.clearPinned(),this.setPushOpen(!1);return}element.closest('.js-drawer-open-right-link[aria-controls="CartDrawer"]')&&!this.hasFemtisSidebar()&&this.isDrawerOpen()&&this.isCartDrawerOpen()&&(this.clearPinned(),this.setPushOpen(!1))}handleDrawerToggle(event){if(window.requestAnimationFrame(this.syncButtons),this.isOpeningReplacementCart)return;const detail=event.detail||{},type=detail.type,forceOpen=detail.forceOpen,hadCartReplacement=this.cartReplacementInProgress,replacementToken=++this.cartReplacementToken;if(this.cancelCartReveal(),this.clearCartReplacementWait(),hadCartReplacement||this.html.classList.remove("drawer-push-handoff"),this.cartReplacementInProgress=!1,hadCartReplacement&&this.html.classList.remove("drawer-no-transition","drawer-push-handoff"),type==="cart"){const drawerIsOpen=this.isDrawerOpen(),cartIsOpen=this.isCartDrawerOpen(),femtisSidebarIsOpen=this.hasFemtisSidebar();if(forceOpen===!0||forceOpen!==!1&&(!drawerIsOpen||femtisSidebarIsOpen)){if(drawerIsOpen&&femtisSidebarIsOpen&&window.wetheme&&typeof window.wetheme.toggleRightDrawer=="function"){if(this.isDesktop()&&cartIsOpen){detail.params&&detail.params.cart&&this.updateCartState(detail.params.cart),event.stopImmediatePropagation(),this.revealOpenCart(),this.closeFemtisSidebarPanels(),this.setPushOpen(!0);return}this.cartReplacementInProgress=!0,detail.forceOpen=!1,this.isDesktop()&&this.html.classList.add("drawer
1-no-transition","drawer-push-handoff"),this.waitForCartRemoval(replacementToken),this.closeFemtisSidebarPanels(),this.setPushOpen(!0);return}this.closeFemtisSidebarPanels(),this.setPushOpen(!0)}else cartIsOpen&&this.isPinned&&this.clearPinned(),this.setPushOpen(!1);return}forceOpen!==!1&&this.setPushOpen(!1)}handleMediaChange(){this.clearPushCloseWait(),this.isDesktop()?this.isDrawerOpen()&&this.isCartDrawerOpen()&&this.setPushOpen(!0):this.html.classList.remove("drawer-push-open","drawer-push-closing","drawer-no-transition","drawer-push-handoff")}}const cartDrawerConfig=document.querySelector(".right-drawer-vue[data-cart-drawer-pinned]");cartDrawerConfig&&(new CartDrawerSidebar(cartDrawerConfig),window.wetheme?.webcomponentRegistry?.register({key:"cart-drawer-sidebar"})); 2//# sourceMappingURL=/cdn/shop/t/43/assets/cart-drawer-sidebar.js.map?v=88640538691191484841789561546
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.