if("function"!=typeof submitAcymForm){let e="",t="";function submitAcymForm(a,l,c){if(e===l)return!1;t=a,window.acyFormName=l,c=void 0===c?"acymSubmitSubForm":c;const i=l?l+"-captcha":"acym-captcha",n=document.querySelector("#"+i+'[class="acyg-recaptcha"][data-size="invisible"]');if(!n||"object"!=typeof grecaptcha)return window[c]();if("acym_ireCaptcha"===n.getAttribute("data-captchaname")){n.className="g-recaptcha";const e=document.querySelector("#"+i+'[class="g-recaptcha"][data-size="invisible"]');if(!e)return window[c]();let t=e.getAttribute("grcID");return t||(t=grecaptcha.render(i,{sitekey:e.getAttribute("data-sitekey"),callback:c,size:"invisible","expired-callback":"resetRecaptcha"}),e.setAttribute("grcID",t)),grecaptcha.getResponse(t)?window[c]():(grecaptcha.execute(t),!1)}{const e=document.getElementById(i);return e?(grecaptcha.ready(function(){grecaptcha.execute(e.getAttribute("data-sitekey"),{action:"submit"}).then(function(e){const t=document.createElement("input");t.setAttribute("type","hidden"),t.setAttribute("name","g-recaptcha-response"),t.setAttribute("value",e);const a=document.getElementById(window.acyFormName);a.appendChild(t),window[c]()&&a.submit()})}),!1):window[c]()}}function resetRecaptcha(){let e="acym-captcha";window.acyFormName&&(e=window.acyFormName+"-captcha");let t=document.querySelector("#"+e+'[class="g-recaptcha"][data-size="invisible"]');if(!t)return;let a=t.getAttribute("grcID");grecaptcha.reset(a)}function acym_resetInvalidClass(){let e=document.querySelectorAll("#"+window.acyFormName+" .acym_invalid_field");if(0!==e.length)for(let t=0;t<e.length;t++)e[t].classList.remove("acym_invalid_field");let t=document.querySelectorAll("#"+window.acyFormName+" .acym__field__error__block");if(0!==t.length)for(let e=0;e<t.length;e++)t[e].classList.remove("acym__field__error__block__active");let a=document.querySelectorAll("#"+window.acyFormName+" .acym__message__invalid__field");if(0!==a.length)for(let e=0;e<a.length;e++)a[e].classList.remove("acym__message__invalid__field__active");let l=document.querySelectorAll("#"+window.acyFormName+" .acym__cross__invalid");if(0!==l.length)for(let e=0;e<l.length;e++)l[e].classList.remove("acym__cross__invalid__active")}function acym_checkEmailField(e,t,a){let l=e.elements[t];if(l){l.value!==acymModule.EMAILCAPTION&&(l.value=l.value.replace(/ /g,""));const e=acymModule.emailRegex;l.value!==acymModule.EMAILCAPTION&&e.test(l.value)||acymAddInvalidClass(l.name,a,acymModule.VALID_EMAIL)}}function acym_checkEmailConfirmationField(e,t,a){let l=e.elements["user[email]"],c=e.elements[t];c&&(l.value===c.value&&""!==c.value||acymAddInvalidClass(t,a,acymModule.VALID_EMAIL_CONFIRMATION))}function acym_handleRequiredRadio(e){let t=document.querySelectorAll("#"+window.acyFormName+' [type="radio"][data-required]');if(0===t.length)return;let a,l="",c=0;for(let i=0;i<t.length;i++){if(a=JSON.parse(t[i].getAttribute("data-required")),""!==l&&l!==t[i].getAttribute("name"))if(0===c){acymAddInvalidClass(l,e,JSON.parse(t[i-1].getAttribute("data-required")).message)}else c=0;t[i].checked&&c++,l=t[i].getAttribute("name")}0===c&&acymAddInvalidClass(l,e,a.message)}function acym_handleRequiredCheckbox(e){let t=document.querySelectorAll("#"+window.acyFormName+' [type="checkbox"][data-required]');if(0===t.length)return;let a,l="",c=0;for(let i=0;i<t.length;i++){a=JSON.parse(t[i].getAttribute("data-required"));let n=t[i].getAttribute("name").slice(0,t[i].getAttribute("name").lastIndexOf("["));if(""!==l&&l!==n)if(0===c){acymAddInvalidClass(l,e,JSON.parse(t[i-1].getAttribute("data-required")).message)}else c=0;t[i].checked&&c++,l=n}0===c&&acymAddInvalidClass(l,e,a.message)}function acym_handleRequiredDate(e){let t=document.querySelectorAll("#"+window.acyFormName+' [acym-field-type="date"][data-required]');if(0===t.length)return;let a="",l=0;for(let c=0;c<t.length;c++){let i=t[c],n=JSON.parse(i.getAttribute("data-required")),r=i.getAttribute("name").slice(0,i.getAttribute("name").lastIndexOf("["));if(""!==a&&a!==r)if(l<3){l=0;let a=JSON.parse(t[c-1].getAttribute("data-required"));acymAddInvalidClass(t[c-1].name,e,a.message)}else l>0&&(l=0);i.value.length>0?l++:acymAddInvalidClass(i.name,e,n.message),a=t[c].getAttribute("name").slice(0,t[c].getAttribute("name").lastIndexOf("["))}}function acym_handleOtherRequiredFields(e){let t=document.querySelectorAll("#"+window.acyFormName+' [data-required]:not([type="checkbox"]):not([type="radio"]):not([acym-field-type="date"]):not([name="captcha_code"])');if(0!==t.length)for(let a=0;a<t.length;a++){let l=JSON.parse(t[a].getAttribute("data-required"));-1===["text","textarea","single_dropdown","multiple_dropdown","phone"].indexOf(l.type)||""!==t[a].value&&"0"!=t[a].value||acymAddInvalidClass(t[a].name,e,l.message),"file"===l.type&&0===t[a].files.length&&acymAddInvalidClass(t[a].name,e,l.message)}}function acym_handleAuthorizedContent(e){let t=document.querySelectorAll("#"+window.acyFormName+" [data-authorized-content]");if(0!==t.length)for(let a=0;a<t.length;a++){let l,c=t[a].getAttribute("data-authorized-content"),i=[];i.push(0);try{let e=c.indexOf("{"),t=c.indexOf("[");!isNaN(e)&&e>0&&!isNaN(t)&&t>0&&(c=c.substring(e)),l=void 0!==c||""!==c?JSON.parse(c):i}catch(e){l=i,console.log(e.stack)}let n="";"number"===l[0]?n=/^[0-9]+$/:"letters"===l[0]?n=/^[a-zA-Z]+$/:"numbers_letters"===l[0]?n=/^[a-zA-Z0-9]+$/:"regex"===l[0]&&(n=new RegExp(l.regex.replace(/^\//,"").replace(/\/$/,""))),""!==n&&t[a].value.length>0&&!n.test(t[a].value)&&acymAddInvalidClass(t[a].name,e,l.message)}}function acymSubmitSubForm(){const a=document.getElementById(window.acyFormName),l={errors:0};if(acym_resetInvalidClass(),acym_checkEmailField(a,"user[email]",l),acym_checkEmailConfirmationField(a,"user[email_confirmation]",l),acym_handleRequiredRadio(l),acym_handleRequiredCheckbox(l),acym_handleRequiredDate(l),acym_handleOtherRequiredFields(l),acym_handleAuthorizedContent(l),l.errors>0)return!1;if(a.elements.hiddenlists.value.length<1){let e=!1,l=a.elements["subscription[]"];if(!l||void 0!==l.value&&0!==l.value.length)l&&l.checked&&(e=!0);else for(let t=0;t<l.length;t++)l[t].checked&&(e=!0);if(!e)return"unsubscribe"!==t?alert(acymModule.NO_LIST_SELECTED):alert(acymModule.NO_LIST_SELECTED_UNSUB),!1}if("unsubscribe"!==t){let e=a.elements.terms;if(e&&!e.checked)return"undefined"!=typeof acymModule&&alert(acymModule.ACCEPT_TERMS),!1;if("undefined"!=typeof acymModule&&void 0!==acymModule["excludeValues"+window.acyFormName])for(let e in acymModule["excludeValues"+window.acyFormName])acymModule["excludeValues"+window.acyFormName].hasOwnProperty(e)&&a.elements[`user[${e}]`]&&a.elements[`user[${e}]`].value==acymModule[`excludeValues${window.acyFormName}`][e]&&(a.elements["user["+e+"]"].value="")}if("undefined"!=typeof ga){ga("send","pageview","unsubscribe"===t?"unsubscribe":"subscribe")}a.task.value=t;let c="";null!=a.elements.acymformtype&&(c=a.elements.acymformtype.value);let i="";if(null!=a.elements.redirect&&(i=a.elements.redirect.value),!a.elements.ajax||!a.elements.ajax.value||"0"===a.elements.ajax.value||0===a.elements.ajax.value)return"shortcode"==c&&""==i&&(a.elements.redirect.value=window.location.href),acymApplyCookie(),!0;const n=document.getElementById(window.acyFormName),r=new FormData(n);n.className+=" acym_module_loading",n.style.filter="alpha(opacity=50)",n.style.opacity="0.5",e=window.acyFormName;const o=document.querySelectorAll(".responseContainer.acym_module_error.message_"+window.acyFormName);return Array.prototype.forEach.call(o,function(e){e.parentNode.removeChild(e)}),fetch(n.getAttribute("action"),{method:"POST",body:r}).then(e=>e.json()).then(e=>{acymDisplayAjaxResponse(e.message,e.type)}).catch(e=>{console.error(e),acymDisplayAjaxResponse("Ajax Request Failure","error")}).finally(()=>{e===window.acyFormName&&(e="")}),!1}function acymAddInvalidClass(e,t,a){let l=document.querySelectorAll("#"+window.acyFormName+' [name^="'+e+'"]'),c=l[0].closest(".onefield");for(let e=0;e<l.length;e++)l[e].classList.add("acym_invalid_field");if(c&&0!==c.length){let e=c.querySelector(".acym__message__invalid__field"),t=c.querySelector(".acym__cross__invalid");if(e&&e.classList.add("acym__message__invalid__field__active"),t&&t.classList.add("acym__cross__invalid__active"),a.length>0){let e=c.querySelector(".acym__field__error__block");e.innerText=a,e.classList.add("acym__field__error__block__active")}}t.errors++}function acymDisplayAjaxResponse(e,t,a){let l=document.createElement("div"),c=document.getElementById("acym_fulldiv_"+window.acyFormName);c.firstChild&&!c.classList.contains("acym__subscription__form__popup__overlay")?c.insertBefore(l,c.firstChild):c.classList.contains("acym__subscription__form__popup__overlay")?c.querySelector(".acym__subscription__form__popup").appendChild(l):c.appendChild(l),l.className="responseContainer";const i=document.getElementById(window.acyFormName);let n="replace";null!=i.elements.successmode&&(n=i.elements.successmode.value);let r=i.className,o="acym_module_loading",s=r.replace(" "+o,"",r);s==r&&(s=r.replace(o+" ","",r)),s==r&&(s=r.replace(o,"",r)),i.className=s,l.innerHTML=e,"success"===t?l.className+=" acym_module_success":(l.className+=" acym_module_error",i.style.opacity="1"),(a||"success"===t&&"toptemp"!==n)&&(i.style.display="none"),l.className+=" message_"+window.acyFormName,l.className+=" slide_open","success"!==t||"replacetemp"!==n&&"toptemp"!==n||setTimeout(()=>{l.remove(),i.style.filter="alpha(opacity=100)",i.style.opacity="1","replacetemp"===n&&(i.style.display="")},3e3),"success"===t&&acymApplyCookie()}function acymApplyCookie(){const e=document.getElementById("acym_fulldiv_"+window.acyFormName);if(e.classList.contains("acym__subscription__form-erase")){const t=document.getElementById(window.acyFormName);let a=t.getAttribute("acym-data-cookie");void 0===a&&(a=1);let l=new Date;l.setDate(l.getDate()+parseInt(a)),document.cookie="acym_form_"+t.getAttribute("acym-data-id")+"="+Date.now()+";expires="+l.toUTCString()+";path=/",setTimeout(()=>{e.remove()},2e3)}}function blockPasteEvent(){document.querySelectorAll('input[name="user[email_confirmation]"]').forEach(e=>{e.addEventListener("paste",e=>{e.preventDefault()})})}window.acyFormName="",blockPasteEvent()};