!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{signupInit:function(){return a},signupSubmitForm:function(){return o}});var n=window.jQuery,i=e.n(n);const o=(e,t)=>{const n=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,o=window?.etCore?.api?.spam?.recaptcha,a=i()(window);if(e.closest(".et_pb_login_form").length&&"function"==typeof window.et_pb_maybe_log_event)return void window.et_pb_maybe_log_event(e.closest(".et_pb_newsletter"),"con_goal");"function"==typeof t?.preventDefault&&t.preventDefault();const _=e.closest(".et_pb_newsletter"),r=_.find(".et_pb_newsletter_fields"),d=_.find(".et_pb_newsletter_error").hide(),l=_.find('input[name="et_pb_signup_firstname"]'),s=_.find('input[name="et_pb_signup_lastname"]'),c=_.find('input[name="et_pb_signup_email"]'),p=_.find('input[name="et_pb_signup_list_id"]').val(),u=_.find('input[name="et_pb_signup_provider"]').val(),f=_.find('input[name="et_pb_signup_account_name"]').val(),b=_.find('input[name="et_pb_signup_ip_address"]').val(),m=_.find('input[name="et_pb_signup_checksum"]').val(),w=_.find(".et_pb_newsletter_success");let h=_.data("redirect_url");const g=_.data("redirect_query"),y={},v=[];let x="<ul>",k="";const C=r.find('input[type=text], .et_pb_checkbox_handle, .et_pb_contact_field[data-type="radio"], textarea, select').filter(".et_pb_signup_custom_field, .et_pb_signup_custom_field *");l.removeClass("et_pb_signup_error"),s.removeClass("et_pb_signup_error"),c.removeClass("et_pb_signup_error"),C.removeClass("et_contact_error"),d.html("");let S=!0;const O=e.closest(".et_pb_newsletter_form form");if(O.length>0&&"function"==typeof O[0].reportValidity&&(S=O[0].reportValidity()),l.length>0&&!l.val()&&(l.addClass("et_pb_signup_error"),S=!1),s.length>0&&!s.val()&&(s.addClass("et_pb_signup_error"),S=!1),n.test(c.val().toString())||(c.addClass("et_pb_signup_error"),S=!1),!S)return;if(C.each(((e,t)=>{let o,a=i()(t);["checkbox","booleancheckbox"].includes(a.data("field_type"))&&(o=a.parents(".et_pb_contact_field"),o.removeClass("et_contact_error")),"radio"===a.data("type")&&(a=a.find('input[type="radio"]'),o=a.parents(".et_pb_contact_field"));let _=a.data("id"),r=a.val(),d=a.siblings("label").first().text();const l=a.data("field_type")??"text";let s=a.data("required_mark")??"not_required";const c=a.data("original_id")??"";let p,f=!1;if(_||(_=c),"radio"===l){if(o&&0!==o.find('input[type="radio"]').length){s=o.find('input[type="radio"]').first().data("required_mark")??"not_required",r="",o.find('input[type="radio"]:checked')&&(r=o.find('input[type="radio"]:checked').val())}d=o.find(".et_pb_contact_form_label").text(),_=a.data("original_id"),i().isEmptyObject(r)||(y[_]=r),0===o.find('input[type="radio"]:checked').length&&(f=!0),r&&(y[_]=r)}else if(["checkbox","booleancheckbox"].includes(l)){if(r={},0!==o.find('input[type="checkbox"]').length){s=o.find(".et_pb_checkbox_handle").data("required_mark")??"not_required",o.find('input[type="checked"]:checked')&&o.find('input[type="checkbox"]:checked').each(((e,t)=>{if("booleancheckbox"===l)r=i()(t).val();else{const e=i()(t).data("id");e&&("object"!=typeof r||Array.isArray(r)||(r[e]=i()(t).val()))}}))}if(d=o.find(".et_pb_contact_form_label").text(),0===d.trim().length){const e=o.find('.et_pb_contact_field_checkbox input[type="checkbox"]');if(e.length>0){const t=[];e.each(((e,n)=>{t.push(i()(n).val())})),d=t.join(", "),0===d.trim().length&&(d=window.et_pb_custom.wrong_checkbox)}}_=o.attr("data-id"),i().isEmptyObject(r)||(y[_]=r),0===o.find('input[type="checkbox"]:checked').length&&(f=!0)}else if("ontraport"===u&&"select"===l){const e=a.find(":selected");y[_]=e.length>0?e.data("id"):r}else y[_]=r;if("mailchimp"===u&&["select","radio"].indexOf(l)>-1){const e="select"===l?a.find(":selected"):o.find('input[type="radio"]:checked'),t=e.length>0?e.data("id"):null;null!==t&&(y[_]={[t]:e.val()})}if(d=d.replace(/"/g,"&quot;"),a.is(":visible")||"hidden"===a.attr("type")||"radio"===a.attr("type"))if("hidden"!==a.attr("type")&&"radio"!==a.attr("type")||a.parents(".et_pb_contact_field").is(":visible")){if("required"!==s||""!==r&&!0!==f||(o?o.addClass("et_contact_error"):a.addClass("et_contact_error"),S=!1,p=d,""===p&&(p=window.et_pb_custom.captcha),k+=`<li>${p}</li>`),"email"===l&&"string"==typeof r){const e=r.toString().trim().toLowerCase(),t=n.test(e);""===e||d===e||t||(a.addClass("et_contact_error"),S=!1,t||(x+=`<li>${window.et_pb_custom.invalid}</li>`))}}else v.push(_);else v.push(c)})),x+="</ul>",""!==k&&("<ul></ul>"!==x&&(x=`<p class="et_normal_padding">${window.et_pb_custom.contact_error_message}</p>${x}`),k=`<ul>${k}</ul>`,k=`<p>${window.et_pb_custom.fill_message}</p>${k}`,x=k+x),"<ul></ul>"!==x)return d.html(x).show(),void(_.parents(".et_pb_section_parallax").length&&_.parents(".et_pb_section_parallax").each(((e,t)=>{!i()(t).children(".et_parallax_bg").hasClass("et_pb_parallax_css")&&a.trigger("resize")})));const j=i().Deferred();o&&_.hasClass("et_pb_recaptcha_enabled")?o.interaction(`Divi/Module/EmailOptin/List/${p}`).then((e=>{j.resolve(e)})):j.resolve(""),i().when(j).done((e=>{i().ajax({type:"POST",url:window.et_pb_custom.ajaxurl,dataType:"json",data:{action:"et_pb_submit_subscribe_form",et_frontend_nonce:window.et_pb_custom.et_frontend_nonce,et_list_id:p,et_firstname:l.val(),et_lastname:s.val(),et_email:c.val(),et_provider:u,et_account:f,et_ip_address:b,et_custom_fields:y,et_hidden_fields:v,token:e,et_checksum:m},beforeSend(){_.find(".et_pb_newsletter_button").addClass("et_pb_button_text_loading").find(".et_subscribe_loader").show()},complete(){_.find(".et_pb_newsletter_button").removeClass("et_pb_button_text_loading").find(".et_subscribe_loader").hide()},success(e){if(!e)return void d.html(window.et_pb_custom.subscription_failed).show();const t=e.data?.error||e.error;if(t||!1===e.success)d.show().append("<h2>").text(t||window.et_pb_custom.subscription_failed);else if(e.success)if(h){const e=(()=>{const e={};return g?(l.length>0&&g.indexOf("name")>-1&&(e.first_name=l.val()),s.length>0&&g.indexOf("last_name")>-1&&(e.last_name=s.val()),g.indexOf("email")>-1&&(e.email=c.val()),g.indexOf("ip_address")>-1&&(e.ip_address=_.data("ip_address")),g.indexOf("css_id")>-1&&(e.form_id=_.attr("id")),decodeURIComponent(i().param(e))):""})();e.length&&(h.indexOf("?")>-1?h+="&":h+="?"),"function"==typeof window.et_pb_maybe_log_event?window.et_pb_maybe_log_event(_,"con_goal",(()=>{window.location.assign(h+e)})):window.location.assign(h+e)}else"function"==typeof window.et_pb_maybe_log_event&&window.et_pb_maybe_log_event(_,"con_goal"),_.find(".et_pb_newsletter_fields").hide(),w.show()}})}))},a=e=>{const t=e||window.diviModuleSignupData;Array.isArray(t)&&t.forEach((({selector:e})=>{const t=i()(e).find(".et_pb_newsletter_field .input"),n=i()(e).find(".et_pb_newsletter_button");t.on("keypress",(e=>{"Enter"!==e?.key&&13!==(e?.which||e?.keyCode)||o(n,e)})),n.on("click",(e=>{o(n,e)}))}))};"diviModuleSignupInit"in window||Object.defineProperty(window,"diviModuleSignupInit",{value:a,writable:!1}),"diviModuleSignupSubmitForm"in window||Object.defineProperty(window,"diviModuleSignupSubmitForm",{value:o,writable:!1}),((window.divi=window.divi||{}).moduleLibrary=window.divi.moduleLibrary||{}).moduleLibraryScriptSignup=t}();