1class InsuranceProduct extends HTMLElement{constructor(){super()}getSectionsToRender(){return[{id:"main-cart-items",section:document.getElementById("main-cart-items")?.dataset?.id||null,selector:".js-contents"},{id:"main-cart-footer",section:document.getElementById("main-cart-footer")?.dataset?.id||null,selector:".js-contents"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"CartDrawer",selector:"#CartDrawer",section:"cart-drawer"}]}renderSections(parsedState){this.getSectionsToRender().forEach(section=>{if(!section.section)return;const sectionElement=document.getElementById(section.id),elementToReplace=sectionElement&§ionElement.querySelector(section.selector)?sectionElement.querySelector(section.selector):sectionElement;elementToReplace&&(elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector))})}getSectionsUrl(){return window.pageNumber?`${window.location.pathname}?page=${window.pageNumber}`:`${window.location.pathname}`}getSectionInnerHTML(html,selector){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}}customElements.get("insurance-product-add")||customElements.define("insurance-product-add",class extends InsuranceProduct{constructor(){super(),this.loader=this.querySelector('[data-asset="loading-spinner"]'),this.label=this.querySelector('[data-asset="button-label"]'),this.addEventListener("click",event=>{event.preventDefault(),this.addInsuranceProduct(this.dataset.actualVariantId,this.dataset.insuranceVariantId,this.dataset.quantity)})}addInsuranceProduct(variantId,insuranceVariantId,quantity){const body=JSON.stringify({id:insuranceVariantId,quantity,properties:{_associate_product:variantId},sections:this.getSectionsToRender().map(section=>section.section),sections_url:this.getSectionsUrl()});this.loader.classList.remove("hidden"),this.label.classList.add("hidden"),fetch(`${routes.cart_add_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);this.renderSections(parsedState),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items",cartData:parsedState,variantId:insuranceVariantId})}).catch(error=>{console.error(error),this.querySelectorAll(".loading__spinner").forEach(overlay=>overlay.classList.add("hidden"));const errors=document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors");errors.textContent=window.cartStrings.error}).finally(()=>{this.loader.classList.add("hidden"),this.label.classList.remove("hidden"),typeof window.freeSampleInit=="function"&&window.freeSampleInit()})}}),customElements.get("insurance-product-remove")||customElements.define("insurance-product-remove",class extends InsuranceProduct{constructor(){super(),this.addEventListener("click",event=>{event.preventDefault(),this.dataset.index?(event.currentTarget.closest('[data-asset="added-insurance-item"]').classList.add("updating"),(this.closest("cart-items")||this.closest("cart-drawer-items")).updateQuantity(this.dataset.index,0)):event.currentTarget.closest('[data-asset="insurance-item"]').classList.add("hidden")})}}); 2//# sourceMappingURL=/cdn/shop/t/646/assets/component-cart-insurance-item.js.map?v=155525414027202399591764668965
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.