1customElements.get("sticky-atc")||customElements.define("sticky-atc",class extends HTMLElement{variantChangeUnsubscriber=void 0;connectedCallback(){this.button=this.querySelector(".sticky-atc__button"),this.buttonLabel=this.button.querySelector("span"),this.titleTarget=this.querySelector(".sticky-atc__variant"),this.priceTarget=this.querySelector(".sticky-atc__price"),this.image=this.querySelector(".sticky-atc__image"),this.sourceForm=document.querySelector("product-info product-form"),this.sourceButton=this.sourceForm?this.sourceForm.querySelector('[name="add"]'):null,this.sourceButton&&(this.button.addEventListener("click",this.onButtonClick.bind(this)),this.observer=new IntersectionObserver(this.onIntersection.bind(this),{threshold:0}),this.observer.observe(this.sourceForm),this.variantChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.variantChange,this.onVariantChange.bind(this)))}disconnectedCallback(){this.observer&&this.observer.disconnect(),this.variantChangeUnsubscriber&&this.variantChangeUnsubscriber()}onButtonClick(){this.button.disabled||this.sourceButton.click()}onIntersection(entries){const entry=entries[0],scrolledPast=!entry.isIntersecting&&entry.boundingClientRect.top<0;this.classList.toggle("sticky-atc--active",scrolledPast),this.setAttribute("aria-hidden",scrolledPast?"false":"true")}onVariantChange(event){const variant=event&&event.data?event.data.variant:null;variant&&(this.updatePrice(event.data.sectionId),this.updateVariantTitle(variant),this.updateImage(variant),this.updateButton())}updatePrice(sectionId){const source=document.getElementById(`price-${sectionId}`);if(!source||!this.priceTarget)return;const onSale=source.querySelector(".price")?.classList.contains("price--on-sale"),priceItem=source.querySelector(onSale?".price-item--sale":".price-item--regular");priceItem&&(this.priceTarget.textContent=priceItem.textContent.trim())}updateVariantTitle(variant){!this.titleTarget||!variant.title||(this.titleTarget.textContent=variant.title)}updateImage(variant){if(!this.image||!variant.featured_image||!variant.featured_image.src)return;const src=variant.featured_image.src;this.image.src=`${src}${src.includes("?")?"&":"?"}width=120`}updateButton(){const disabled=this.sourceButton.hasAttribute("disabled");if(this.button.disabled=disabled,!this.buttonLabel)return;const sourceLabel=this.sourceButton.querySelector("span");this.buttonLabel.textContent=disabled&&sourceLabel?sourceLabel.textContent.trim():this.button.dataset.defaultLabel}}); 2//# sourceMappingURL=/cdn/shop/t/13/assets/sticky-atc.js.map?v=34895529115406673931787065539
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.