1document.addEventListener("DOMContentLoaded",()=>{const stickyContainers=document.querySelectorAll(".sticky-atc");if(!("IntersectionObserver"in window)||stickyContainers.length===0)return;const debounce=(fn,delay)=>{let timeoutId;return(...args)=>{window.clearTimeout(timeoutId),timeoutId=window.setTimeout(()=>fn(...args),delay)}},getFirstCarouselImageSrc=sectionRoot=>{const isVisible=el=>el&&el.offsetParent!==null,customGalleries=[...sectionRoot.querySelectorAll(".custom-gallery")],customGallery=customGalleries.find(gallery2=>isVisible(gallery2)&&gallery2.getAttribute("aria-hidden")!=="true")||customGalleries.find(gallery2=>gallery2.getAttribute("aria-hidden")!=="true")||customGalleries[0];if(customGallery){const img2=customGallery.querySelector(".product__media-item img");return img2?.currentSrc||img2?.src||null}const gallery=[...sectionRoot.querySelectorAll("media-gallery")].find(el=>isVisible(el))||sectionRoot.querySelector("media-gallery");if(!gallery)return null;const img=(gallery.querySelector(".product__media-item.is-active")||gallery.querySelector(".product__media-item[data-media-id]:not([hidden])")||gallery.querySelector(".product__media-item"))?.querySelector("img");return img?.currentSrc||img?.src||null},initStickyProductImage=container=>{const stickyImage=container.querySelector(".sticky-atc__product-image");if(!stickyImage)return;const sectionRoot=container.closest(".shopify-section")||container.closest("section");if(!sectionRoot)return;const setFirstCarouselImage=()=>{const src=getFirstCarouselImageSrc(sectionRoot);src&&(stickyImage.getAttribute("src")!==src&&stickyImage.src!==src&&(stickyImage.src=src),stickyImage.removeAttribute("srcset"),stickyImage.removeAttribute("sizes"))};setFirstCarouselImage();const carouselImg=sectionRoot.querySelector(".custom-gallery .product__media-item img, media-gallery .product__media-item img");carouselImg&&!carouselImg.complete&&carouselImg.addEventListener("load",setFirstCarouselImage,{once:!0});const syncImage=debounce(setFirstCarouselImage,50),observeVisibility=el=>{el&&new MutationObserver(syncImage).observe(el,{attributes:!0,attributeFilter:["style","class","hidden","aria-hidden"]})};sectionRoot.querySelectorAll(".product__media-wrapper").forEach(wrapper=>{observeVisibility(wrapper),[...wrapper.children].forEach(observeVisibility)}),sectionRoot.querySelectorAll("media-gallery, .custom-gallery").forEach(observeVisibility),sectionRoot.addEventListener("change",event=>{const target=event.target;!(target instanceof HTMLInputElement)&&!(target instanceof HTMLSelectElement)||target.matches('input[name="purchase_type"], input[type="radio"], .sticky-atc__selector-native, select')&&window.requestAnimationFrame(()=>syncImage())})}
1,initCustomSelector=container=>{const selector=container.querySelector(".sticky-atc__selector"),nativeSelect=container.querySelector(".sticky-atc__selector-native");if(!selector||!nativeSelect)return;let panel=selector.querySelector(".sticky-atc__selector-panel");panel||(panel=document.createElement("div"),panel.className="sticky-atc__selector-panel",panel.hidden=!0,selector.appendChild(panel));const closePanel=()=>{panel.hidden=!0,selector.classList.remove("is-open")},rebuildPanel=()=>{panel.innerHTML="",[...nativeSelect.options].forEach(option=>{const optionButton=document.createElement("button");optionButton.type="button",optionButton.className="sticky-atc__selector-option",option.selected&&optionButton.classList.add("is-selected");const nameEl=document.createElement("span");nameEl.className="sticky-atc__selector-option-name",nameEl.textContent=option.dataset.name||option.textContent;const priceEl=document.createElement("span");priceEl.className="sticky-atc__selector-option-price",priceEl.textContent=option.dataset.price||"",optionButton.append(nameEl,priceEl),optionButton.addEventListener("click",event=>{event.stopPropagation(),nativeSelect.value=option.value,nativeSelect.dispatchEvent(new Event("change",{bubbles:!0})),closePanel()}),panel.appendChild(optionButton)})};selector.classList.add("sticky-atc__selector--custom"),rebuildPanel(),selector.addEventListener("click",event=>{event.target.closest(".sticky-atc__selector-option")||(event.preventDefault(),event.stopPropagation(),panel.hidden?(rebuildPanel(),panel.hidden=!1,selector.classList.add("is-open")):closePanel())}),document.addEventListener("click",event=>{selector.contains(event.target)||closePanel()}),new MutationObserver(debounce(rebuildPanel,50)).observe(nativeSelect,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["selected","data-name","data-price"]})};stickyContainers.forEach(container=>{initStickyProductImage(container),initCustomSelector(container);const targetSelector=container.dataset.target,targetButton=document.querySelector(targetSelector);if(!targetButton)return;const stickyButton=container.querySelector(".sticky-atc__button");if(!stickyButton)return;const syncButtonState=()=>{const copiedClasses=[...targetButton.classList].filter(cls=>cls!=="button--full-width");stickyButton.className=["sticky-atc__button",...copiedClasses].join(" "),stickyButton.disabled=targetButton.disabled;const targetSpinner=targetButton.querySelector(".loading__spinner"),stickySpinner=stickyButton.querySelector(".loading__spinner");if(targetSpinner&&stickySpinner&&(stickySpinner.className=targetSpinner.className),targetButton.hasAttribute("aria-disabled")?stickyButton.setAttribute("aria-disabled",targetButton.getAttribute("aria-disabled")):stickyButton.removeAttribute("aria-disabled"),!stickyButton.querySelector("[x-text]")){const stickyLabel=stickyButton.querySelector("span:not(.loading__spinner)"),targetLabel=targetButton.querySelector("span:not(.loading__spinner)");stickyLabel&&targetLabel&&!stickyLabel.hasAttribute("x-text")&&(stickyLabel.innerHTML=targetLabel.innerHTML)}};syncButtonState(),stickyButton.addEventListener("click",()=>{targetButton.disabled||targetButton.getAttribute("aria-disabled")==="true"||(targetButton.click(),syncButtonState())}),new MutationObserver(syncButtonState).observe(targetButton,{attributes:!0,childList:!0,subtree:!0,characterData:!0});const isHomepage=document.body.classList.contains("template-index");let scrollAllowsSticky=!1,footerPastHalfway=!1;const updateStickyState=()=>{if(container.hasAttribute("hidden")){container.classList.remove("active");return}scrollAllowsSticky&&!footerPastHalfway?container.classList.add("active"):container.classList.remove("active")},footer=document.querySelector("footer.footer");if(footer&&new IntersectionObserver(([entry])=>{footerPastHalfway=entry.intersectionRatio>=.5,updateStickyState()},{threshold:[0,.5,1]}).observe(footer),isHomepage){let mainButtonHidden=!1,sectionReached=!1;const syncHomepageScroll=()=>{scrollAllowsSticky=sectionReached&&mainButtonHidden,updateStickyState()},heroSection=document.querySelector("#MainContent > .shopify-section:first-child"),buttonObserver=new IntersectionObserver(entries=>
1{entries.forEach(entry=>{mainButtonHidden=!entry.isIntersecting,syncHomepageScroll()})});heroSection&&new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting?sectionReached=!1:sectionReached=entry.boundingClientRect.top<0,syncHomepageScroll()})},{threshold:.55}).observe(heroSection),buttonObserver.observe(targetButton)}else new IntersectionObserver(entries=>{entries.forEach(entry=>{scrollAllowsSticky=!entry.isIntersecting,updateStickyState()})}).observe(targetButton)})}); 2//# sourceMappingURL=/cdn/shop/t/46/assets/sticky-atc.js.map?v=180215497646723632371790866774
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.