1customElements.get("product-form")||customElements.define("product-form",class extends HTMLElement{constructor(){super(),this.form=this.querySelector("form"),this.form.querySelector("[name=id]").disabled=!1,this.form.addEventListener("submit",this.onSubmitHandler.bind(this)),this.cartNotification=document.querySelector("cart-notification"),this.submitButton=this.querySelector('[name="add-to-cart"]'),this.submitButton.addEventListener("click",this.onSubmitHandler.bind(this))}onSubmitHandler(evt){if(evt.preventDefault(),evt.stopPropagation(),this.submitButton.getAttribute("aria-disabled")==="true")return;this.handleErrorMessage(),this.cartNotification&&this.cartNotification.setActiveElement(document.activeElement),this.submitButton.setAttribute("aria-disabled",!0),this.submitButton.classList.add("loading"),this.querySelector(".loading-overlay__spinner")?.classList.remove("hidden");const config=fetchConfig("javascript");config.headers["X-Requested-With"]="XMLHttpRequest",delete config.headers["Content-Type"];const formData=new FormData(this.form);this.cartNotification&&formData.append("sections",this.cartNotification.getSectionsToRender().map(section=>section.id)),formData.append("sections_url",window.location.pathname),formData.get("selling_plan")||(formData.delete("properties[_subscription_terms]"),formData.delete("properties[_pricebook]")),config.body=formData;const addItemToCart=()=>fetch(`${routes.cart_add_url}`,config);(this.getAttribute("data-clear-cart-before-add")==="true"?fetch(`${routes.cart_clear_url}.js?hsfastcart=false`,{method:"POST",headers:{"X-Requested-With":"XMLHttpRequest"}}):Promise.resolve()).then(()=>addItemToCart()).then(response=>response.json()).then(response=>{if(response.status){this.handleErrorMessage(response.description);const soldOutMessage=this.submitButton.querySelector(".sold-out-message");if(!soldOutMessage)return;this.submitButton.setAttribute("aria-disabled",!0),this.submitButton.querySelector("span").classList.add("hidden"),soldOutMessage.classList.remove("hidden"),this.error=!0;return}this.error=!1;const quickAddModal=this.closest("quick-add-modal");quickAddModal?(document.body.addEventListener("modalClosed",()=>{setTimeout(()=>{this.cartNotification.renderContents(response)})},{once:!0}),quickAddModal.hide(!0)):this.cartNotification&&this.cartNotification.renderContents(response),"middleStep"in this.dataset&&this.dataset.middleStep!==""?location.href=this.dataset.middleStep:window.HS_SLIDE_CART_OPEN()}).catch(e=>{console.error(e)}).finally(()=>{this.submitButton.classList.remove("loading"),this.error||this.submitButton.removeAttribute("aria-disabled"),this.querySelector(".loading-overlay__spinner")?.classList.add("hidden")})}handleErrorMessage(errorMessage=!1){this.errorMessageWrapper=this.errorMessageWrapper||this.querySelector(".product-form__error-message-wrapper"),this.errorMessageWrapper&&(this.errorMessage=this.errorMessage||this.errorMessageWrapper.querySelector(".product-form__error-message"),this.errorMessageWrapper.toggleAttribute("hidden",!errorMessage),errorMessage&&(this.errorMessage.textContent=errorMessage))}}); 2//# sourceMappingURL=/cdn/shop/t/23/assets/product-form.js.map?v=115311453028547520321786559766
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.