"use strict";(self.webpackChunkhello_plus=self.webpackChunkhello_plus||[]).push([[498],{4719:function(e,t,s){s.r(t),t.default=elementorModules.frontend.handlers.Base.extend({getDefaultSettings(){return{selectors:{form:".ehp-form"}}},getDefaultElements(){const e=this.getSettings("selectors");return{$form:this.$element[0].querySelector(e.form),$submitButton:this.$element[0].querySelector(e.submitButton)}},bindEvents(){this.elements.$form.addEventListener("form_destruct",this.handleSubmit.bind(this))},handleSubmit(e){const{detail:{data:{redirect_url:t=""}={}}={}}=e;t&&(location.href=t)}})},4746:function(e,t,s){s.r(t),t.default=elementorModules.frontend.handlers.Base.extend({getDefaultSettings(){return{selectors:{form:".ehp-form",submitButton:'[type="submit"]'},action:"helloplus_forms_lite_send_form",ajaxUrl:elementorFrontendConfig.urls.ajaxurl,nonce:ehpFormsData.nonce}},getDefaultElements(){const e=this.getSettings("selectors");return{$form:this.$element[0].querySelector(e.form),$submitButton:this.$element[0].querySelector(e.submitButton)}},bindEvents(){this.elements.$form.addEventListener("submit",this.handleSubmit.bind(this))},beforeSend(){const e=this.elements.$form;e.style.opacity="0.45",e.classList.add("elementor-form-waiting");const t=e.querySelector(".elementor-message");t&&t.remove();const s=e.querySelector(".elementor-error");s&&s.classList.remove("elementor-error"),e.querySelectorAll("div.elementor-field-group").forEach(e=>{e.classList.remove("error");const t=e.querySelector("span.elementor-form-help-inline");t&&t.remove(),e.querySelectorAll(":input").forEach(e=>e.setAttribute("aria-invalid","false"))}),this.elements.$submitButton.setAttribute("disabled","disabled");const n=document.createElement("span");n.classList.add("elementor-button-text","elementor-form-spinner"),n.innerHTML='<i class="fa fa-spinner fa-spin"></i>&nbsp;',this.elements.$submitButton.prepend(n)},getFormData(){const e=new FormData(this.elements.$form);return e.append("action",this.getSettings("action")),e.append("nonce",this.getSettings("nonce")),e.append("referrer",location.toString()),e},onSuccess(e){const t=this.elements.$form;this.elements.$submitButton.removeAttribute("disabled");const s=this.elements.$submitButton.querySelector(".elementor-form-spinner");if(s&&s.remove(),t.style.opacity="1",t.classList.remove("elementor-form-waiting"),e.success){t.dispatchEvent(new CustomEvent("submit_success",{detail:e.data})),t.dispatchEvent(new CustomEvent("form_destruct",{detail:e.data})),t.reset();const s=["elementor-message","elementor-message-success"];if(elementorFrontendConfig.experimentalFeatures.e_font_icon_svg&&s.push("elementor-message-svg"),e.data.message&&""!==e.data.message){const n=document.createElement("div");n.classList.add(...s),n.setAttribute("role","alert"),n.textContent=e.data.message,t.appendChild(n)}}else{e.data.errors&&(Object.entries(e.data.errors).forEach(([e,s])=>{const n=t.querySelector(`#form-field-${e}`);if(n){n.parentElement.classList.add("elementor-error");const e=document.createElement("span");e.classList.add("elementor-message","elementor-message-danger","elementor-help-inline","elementor-form-help-inline"),e.setAttribute("role","alert"),e.textContent=s,n.parentElement.appendChild(e);const t=n.querySelector("input");t&&t.setAttribute("aria-invalid","true")}}),t.dispatchEvent(new Event("error")));const s=document.createElement("div");s.classList.add("elementor-message","elementor-message-danger"),s.setAttribute("role","alert"),s.textContent=e.data.message,t.appendChild(s)}},onError(e,t){const s=this.elements.$form,n=document.createElement("div");n.classList.add("elementor-message","elementor-message-danger"),n.setAttribute("role","alert"),n.textContent=t,s.appendChild(n),this.elements.$submitButton.innerHTML=this.elements.$submitButton.textContent,this.elements.$submitButton.removeAttribute("disabled"),s.style.opacity="1",s.classList.remove("elementor-form-waiting"),s.dispatchEvent(new Event("error"))},handleSubmit(e){if(e.preventDefault(),this.elements.$form.classList.contains("elementor-form-waiting"))return!1;this.beforeSend(),fetch(this.getSettings("ajaxUrl"),{method:"POST",body:this.getFormData()}).then(e=>e.json()).then(e=>this.onSuccess(e)).catch(e=>this.onError(null,e))}})}}]);