1document.addEventListener("DOMContentLoaded",function(){setTimeout(function(){initStickyAddToCart()},500);function initStickyAddToCart(){const stickyElement=document.getElementById("stickyAddToCart"),addToCartSelectors=['button[name="add"]',"button.add-to-cart","button.add-to-cart-button","button.product-form__cart-submit","button.product-form__submit",'form[action*="/cart/add"] button[type="submit"]',".ProductForm__AddToCart"];let addToCartButton=null;for(const selector of addToCartSelectors){const button=document.querySelector(selector);if(button){addToCartButton=button;break}}if(addToCartButton)setupScrollHandler();else{const observer=new MutationObserver(function(mutations){for(const selector of addToCartSelectors){const button=document.querySelector(selector);if(button){addToCartButton=button,observer.disconnect(),setupScrollHandler();break}}});observer.observe(document.body,{childList:!0,subtree:!0}),setTimeout(function(){observer.disconnect()},1e4)}function setupScrollHandler(){let isVisible=!1,debounceTimer=null;function handleScroll(){if(!addToCartButton)return;const desktopShipping=document.querySelector(".sticky-add-to-cart__shipping"),mobileShipping=document.querySelector(".mobile-shipping-info");desktopShipping&&window.stickySettings&&(window.stickySettings.showDesktopShipping===!1||window.stickySettings.showDeliveryDate===!1)&&(desktopShipping.style.display="none",desktopShipping.setAttribute("aria-hidden","true")),mobileShipping&&window.stickySettings&&(window.stickySettings.showMobileShipping===!1||window.stickySettings.showDeliveryDate===!1)&&(mobileShipping.style.display="none",mobileShipping.setAttribute("aria-hidden","true"));const cartDrawerWrapper=document.querySelector("cart-drawer.drawer, .drawer.cart-drawer, .cart-drawer"),cartSidebar=document.querySelector("#sidebar-cart, #CartDrawer, .cart-sidebar");if(cartDrawerWrapper&&(cartDrawerWrapper.classList.contains("active")||cartDrawerWrapper.classList.contains("is-open")||cartDrawerWrapper.classList.contains("drawer--is-open")||cartDrawerWrapper.hasAttribute("open")||cartDrawerWrapper.getAttribute("aria-hidden")==="false")||cartSidebar&&(cartSidebar.classList.contains("is-open")||cartSidebar.classList.contains("drawer--is-open")||cartSidebar.getAttribute("aria-hidden")==="false")){hideStickyButton();return}const buttonBottom=addToCartButton.getBoundingClientRect().bottom,shouldBeVisible=buttonBottom<-100;shouldBeVisible!==isVisible&&(clearTimeout(debounceTimer),debounceTimer=setTimeout(()=>{shouldBeVisible?showStickyButton():buttonBottom>50&&hideStickyButton()},50))}function showStickyButton(){isVisible||(applyMobileStickyOffset(),stickyElement.style.display="block",stickyElement.offsetWidth,stickyElement.classList.add("show"),applyMobileStickyOffset(),isVisible=!0)}function hideStickyButton(){isVisible&&(stickyElement.classList.remove("show"),window.innerWidth<=767&&(stickyElement.style.opacity="0",stickyElement.style.transform="translateY(100%)"),setTimeout(()=>{stickyElement.classList.contains("show")||(stickyElement.style.display="none"),isVisible=!1},400))}function applyMobileStickyOffset(){window.innerWidth<=767?(stickyElement.style.setProperty("bottom","calc(65px + env(safe-area-inset-bottom))","important"),stickyElement.style.setProperty("transform","translateY(0)","important"),stickyElement.style.setProperty("opacity","1","important"),document.body.style.setProperty("padding-bottom","calc(145px + env(safe-area-inset-bottom))","important")):(stickyElement.style.removeProperty("bottom"),stickyElement.style.removeProperty("transform"),stickyElement.style.removeProperty("opacity"),document.body.style.removeProperty("padding-bottom"))}window.addEventListener("scroll",handleScroll,{passive:!0}),window.addEventListener("resize",function(){isVisible&&applyMobileStickyOffset(),handleScroll()},{passive:!0}),document.addEventListener("click",function(e){e.target.closest('[data-action="open-drawer"], [data-open-cart], .js-drawer-open-cart, .cart-link')&&setTimeout(handleScroll,100)}),document.addEventListener("cart:open",handleScroll),document.addEventListener("cart-drawer:open",handleScroll),document.addEventListener("cart.requestStarted",handleScroll),document.addEventListener("cartDrawerOpened",handleScroll);const drawerObserver=new MutationObserver(function(mutations){for(let mutation of mutations)mutation.type==="attributes"&&(mutation.attributeName==="aria-hidden"||mutation.attributeName==="class"||mutation.attributeName==="open")&&handleScroll()});document.querySelectorAll("cart-drawer, #sidebar-cart, #CartDrawer, .cart-drawer").forEach(drawer=>{drawerObserver.observe(drawer,{attributes:!0})}),setTimeout(handleScroll,300),setInterval(handleScroll,2e3)}}});function scrollToTop(event){event.preventDefault(),window.scrollTo({top:0,behavior:"smooth"})}window.scrollToTop=scrollToTop; 2//# sourceMappingURL=/cdn/shop/t/101/assets/sticky-add-to-cart.js.map?v=160727440206111987791786358062
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.