1class FormSubmit extends HTMLElement{constructor(){super()}connectedCallback(){const that=this;this.onclick=e=>{if(that.hasAttribute("disabled"))return;e.preventDefault(),that.setAttribute("loading",""),that.form=that.closest("form");const formId=that.form.getAttribute("id"),formErrorsTarget=document.querySelector(`#${formId} form-errors`),formSuccess=document.querySelector(`#${formId} form-success`);formErrorsTarget||console.warn(`Form with ID: ${formId} does not contain a form-errors container. No errors will be shown`),fetch(that.form.getAttribute("action"),{method:that.form.getAttribute("method"),body:new FormData(that.form)}).then(res=>res.text()).then(text=>{const htmlResponse=new CustomDOMParser().parseFromString(text);if(htmlResponse.querySelector('link[rel="canonical"]')&&htmlResponse.querySelector('link[rel="canonical"]').getAttribute("href").includes("/challenge")){console.warn("Disable recaptcha"),that.removeAttribute("loading");return}if(htmlResponse.querySelector("title")&&htmlResponse.querySelector("title").innerHTML=="Too many attempts"&&formErrorsTarget){formErrorsTarget.innerHTML='<p class="errors spacing-bottom-m">Too many attempts. Try again later.</p>',that.form.dispatchEvent(new CustomEvent("form:submit:error",{detail:{error:"Too many attempts",response:htmlResponse}})),that.removeAttribute("loading");return}let formErrors=htmlResponse.querySelector(`#${formId} form-errors`);formErrors?formErrors=formErrors.innerHTML.trim():formErrors="",formErrors!=""&&formErrorsTarget?(formErrorsTarget.innerHTML=formErrors,that.form.dispatchEvent(new CustomEvent("form:submit:error",{detail:{error:formErrors}}))):(that.form.dispatchEvent(new CustomEvent("form:submit:success",{})),formErrors==""&&formErrorsTarget&&(formErrorsTarget.innerHTML=""),formSuccess&&(formSuccess.style.display="block")),that.removeAttribute("loading")}).catch(err=>{that.form.dispatchEvent(new CustomEvent("form:submit:error",{detail:{error:err}})),that.removeAttribute("loading")})}}}customElements.define("form-submit",FormSubmit),customElements.define("form-errors",class extends HTMLElement{}),customElements.define("form-success",class extends HTMLElement{}); 2//# sourceMappingURL=/cdn/shop/t/676/assets/form-components.js.map?v=99297128359493373841736938651
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.