1import{processDynamicHTML}from"ia-util-helpers";const productInfo=new Map;export class IaQuickBuyOpener extends HTMLElement{connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}handleKeyDown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.handleClick(e))}buildRequestUrl(productHandle){return`/products/${productHandle}`}async fetchProductSection(productHandle){const requestUrl=this.buildRequestUrl(productHandle);if(productInfo.has(requestUrl))return productInfo.get(requestUrl);const fetchPromise=fetch(requestUrl).then(response=>{if(!response.ok)throw new Error(`Failed to fetch product section: ${response.status}`);return response.text()}).then(responseText=>new DOMParser().parseFromString(responseText,"text/html"));return productInfo.set(requestUrl,fetchPromise),fetchPromise}async handleClick(e){e.preventDefault(),e.stopPropagation();const productHandle=this.getAttribute("product-handle");if(!productHandle){console.warn("ia-quick-buy-opener: product-handle attribute is required");return}try{const productSection=(await this.fetchProductSection(productHandle)).querySelector("ia-pdp");if(!productSection){console.warn("ia-quick-buy-opener: Product section not found in fetched HTML");return}const sectionWrapper=productSection.closest('[id^="shopify-section-"]');if(!sectionWrapper){console.warn("ia-quick-buy-opener: Section wrapper not found in fetched HTML");return}const container=document.getElementById("ia-quick-buy");if(!container){console.error("ia-quick-buy-opener: #ia-quick-buy container not found in page");return}const sectionDoc=new DOMParser().parseFromString(sectionWrapper.outerHTML,"text/html");processDynamicHTML(sectionDoc);const quickBuyElement=document.createElement("ia-quick-buy"),clonedSection=productSection.cloneNode(!0);clonedSection.querySelectorAll("[data-cs-override-id]").forEach(el=>{el.dataset.csOverrideId=el.dataset.csOverrideId.replace(/^pdp-/,"quickbuy-")}),quickBuyElement.appendChild(clonedSection),container.innerHTML="",container.appendChild(quickBuyElement),document.dispatchEvent(new CustomEvent("shopify:section:load"))}catch(error){console.error("ia-quick-buy-opener: Error fetching product section:",error)}}}export class IaQuickBuy extends HTMLElement{connectedCallback(){this.drawer=this.closest("ia-drawer-component");const title=this.querySelector(":is(h1, h2, h3, h4, h5, h6).ia-block-text");this.drawer&&this.drawer.open();const infoLink=this.querySelector("[data-quick-buy-info-link]");infoLink&&infoLink.classList.remove("ia-hidden"),title&&title.textContent.trim()!==""&&(title.style.display="none",this.drawer.querySelector(".ia-drawer__title").textContent=title.textContent)}}customElements.define("ia-quick-buy-opener",IaQuickBuyOpener),customElements.define("ia-quick-buy",IaQuickBuy); 2//# sourceMappingURL=/cdn/shop/t/562/assets/ia-quick-buy.js.map?v=14068217597290405401788432558
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.