1import{P as l}from"./quickview-dvXYpbPc.js";import{f as u}from"./utils-oHofwCfm.js";function n(o,t=300,e="ease-in-out"){const i=o.animate([{opacity:1},{opacity:0}],{duration:t,easing:e});o.classList.add("closing"),i.addEventListener("finish",()=>{o.close(),o.classList.remove("closing")})}function c(o,t=300,e="ease-in-out"){o.addEventListener("cancel",i=>{i.preventDefault(),n(o,t,e)})}const a=o=>({prevScrollY:0,scrollingUp:!0,isScrollTop:!0,offset:0,notifySelector:"[data-shopify-cart-notify]",...o,showMiniCart:!1,showMobileMenu:!1,mobilePrevScrollY:0,activeMobileSubmenu:null,activeMobileSubmenuLevel:0,submenuStack:[],init(){window.addEventListener("scroll",t=>this.onScroll(t)),this.onScroll(),this.$watch("showMobileMenu",t=>{if(this.handleMobileMenuChromeTransformBug(),!t)this.activeMobileSubmenu=null,this.activeMobileSubmenuLevel=0,this.submenuStack=[],this.$nextTick(()=>{window.scrollTo({top:this.mobilePrevScrollY,behavior:"instant"})});else{this.mobilePrevScrollY=window.scrollY;const e=document.body.querySelector("#announcement-bar")?.clientHeight||0;this.mobilePrevScrollY<e&&window.scrollTo({top:e,behavior:"smooth"})}}),this.setupPopup(),this.setupNotifyMe(),this.setupQuickView()},handleMobileMenuChromeTransformBug(){const t=document.querySelectorAll("#mobileMenu .mobile-submenu");this.showMobileMenu?setTimeout(()=>{t.forEach(e=>{e.style.position=""})},50):setTimeout(()=>{t.forEach(e=>{e.style.position="fixed"})},30)},onScroll(t){const e=window.scrollY<0?0:window.scrollY;this.scrollingUp=e<=this.prevScrollY,this.prevScrollY=e,this.isScrollTop=e<=this.offset},gotoSubmenu(t){this.submenuStack.push(t),this.activeMobileSubmenu=this.submenuStack[this.submenuStack.length-1],this.activeMobileSubmenuLevel=this.submenuStack.length},backToParentSubmenu(){this.submenuStack.length&&(this.submenuStack.pop(),this.activeMobileSubmenu=this.submenuStack[this.submenuStack.length-1],this.activeMobileSubmenuLevel=this.submenuStack.length)},setupNotifyMe(){document.addEventListener("click",async t=>{if(!this.notifySelector)return;const e=t.target?.closest(this.notifySelector);if(!e||!e.dataset.shopifyCartNotify)return;const i=await u(`${window.Shopify?.routes?.root||"/"}products/${e.dataset.shopifyCartNotify}?section_id=notify-me`).then(s=>s?.innerHTML);window.popup?.insertContent(i)})},setupPopup(){if(!window.popup){console.warn("Popup not found");return}window.popup.addEventListener("click",e=>{e.target===window.popup&&n(window.popup,200)}),window.popup.insertContent=e=>{if(window.popup.querySelector("[data-popup-content]").innerHTML=e||"",!e){window.popup.close();return}window.popup.open||window.popup.showModal()},window.popup.replaceContent=window.popup.insertContent,window.popup.performClose=()=>{n(window.popup,200)};const t={close:"[data-popup-close]",cancel:"[data-popup-cancel]"};c(window.popup,200),window.popup.addEventListener("click",e=>{(e.target?.closest(t.close)!==null||e.target?.closest(t.cancel)!==null)&&n(window.popup,200)})},setupDialog(t,e=300){this.$watch(t,i=>{i?this.$el.showModal():n(this.$el,e)})},setupQuickView(){document.addEventListener("click",t=>{const e=t.target?.closest("[data-product-quick-view]");e&&e.dataset.productQuickView&&new l(e.dataset.productQuickView)})}});export{a as default};
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.