File Editor
Directories:
.. (Back)
fields
Files:
wpforms-confirmation.js
wpforms-confirmation.min.js
wpforms-modern.js
wpforms-modern.min.js
wpforms.js
wpforms.min.js
Create New File
Create
Edit File: wpforms.min.js
var wpforms=window.wpforms||function(s,p,d){const l={cache:{},isUpdatingToken:!1,init(){d(l.ready),d(p).on("load",function(){"function"==typeof d.ready.then?d.ready.then(l.load):l.load()}),l.bindUIActions(),l.bindOptinMonster()},ready(){l.clearUrlQuery(),l.setUserIdentifier(),l.loadValidation(),l.loadHoneypot(),l.loadDatePicker(),l.loadTimePicker(),l.loadInputMask(),l.loadSmartPhoneField(),l.loadPayments(),l.loadMailcheck(),l.loadChoicesJS(),l.initTokenUpdater(),l.restoreSubmitButtonOnEventPersisted(),l.bindSmartPhoneField(),l.bindChoicesJS(),d(".wpforms-randomize").each(function(){for(var e=d(this),t=e.children();t.length;)e.append(t.splice(Math.floor(Math.random()*t.length),1)[0])}),d(".wpforms-page-button").prop("disabled",!1),l.initFormsStartTime(),d(s).trigger("wpformsReady"),d(".wpforms-smart-phone-field").each(function(){l.repairSmartPhoneHiddenField(d(this))})},load(){},clearUrlQuery(){var e=p.location;let t=e.search;-1!==t.indexOf("wpforms_form_id=")&&(t=t.replace(/([&?]wpforms_form_id=[0-9]*$|wpforms_form_id=[0-9]*&|[?&]wpforms_form_id=[0-9]*(?=#))/,""),history.replaceState({},null,e.origin+e.pathname+t))},loadHoneypot(){d(".wpforms-form").each(function(){const e=d(this),t=e.data("formid"),r=[],a=[];var i,o,s,n;void 0!==wpforms_settings.hn_data[t]&&(d(`#wpforms-form-${t} .wpforms-field`).each(function(){var e=d(this);r.push(e.data("field-id")),a.push(e.find(".wpforms-field-label").text())}),i=l.getHoneypotRandomLabel(a.join(" ").split(" ")),o=l.getHoneypotFieldId(r),n=r[Math.floor(Math.random()*r.length)],s=`wpforms-${t}-field_`+o,d(`#wpforms-${t}-field_${n}-container`,e).before(` <div id="${s}-container" class="wpforms-field wpforms-field-text" data-field-type="text" data-field-id="${o}" style="position: absolute !important; overflow: hidden !important; display: inline !important; height: 1px !important; width: 1px !important; z-index: -1000 !important; padding: 0 !important;"> <label class="wpforms-field-label" for="${s}" aria-hidden="true" style="counter-increment: none;">${i}</label> <input type="text" id="${s}" class="wpforms-field-medium" name="wpforms[fields][${o}]" aria-hidden="true" style="visibility: hidden;" tabindex="-1"> </div>`),(n=d(`#wpforms-${t}-field_${wpforms_settings.hn_data[t]}-container`,e)).find("input").attr({tabindex:"-1","aria-hidden":"true"}),n.find("label").attr("aria-hidden","true"))})},getHoneypotRandomLabel(t){let r="";for(let e=0;e<3;e++)r+=t[Math.floor(Math.random()*t.length)]+" ";return r.trim()},getHoneypotFieldId(t){var r=Math.max(...t);let a=0;for(let e=1;e<r;e++)if(!t.includes(e)){a=e;break}return a=a||r+1},loadValidation(){void 0!==d.fn.validate&&(d(".wpforms-input-temp-name").each(function(e,t){var r=Math.floor(9999*Math.random())+1;d(this).attr("name","wpf-temp-"+r)}),d(s).on("change",".wpforms-validate input[type=url]",function(){var e=d(this).val();if(!e)return!1;"http://"!==e.substr(0,7)&&"https://"!==e.substr(0,8)&&d(this).val("https://"+e)}),d.validator.messages.required=wpforms_settings.val_required,d.validator.messages.url=wpforms_settings.val_url,d.validator.messages.email=wpforms_settings.val_email,d.validator.messages.number=wpforms_settings.val_number,void 0!==d.fn.payment&&d.validator.addMethod("creditcard",function(e,t){e=d.payment.validateCardNumber(e);return this.optional(t)||e},wpforms_settings.val_creditcard),d.validator.addMethod("extension",function(e,t,r){return r="string"==typeof r?r.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(t)||e.match(new RegExp("\\.("+r+")$","i"))},wpforms_settings.val_fileextension),d.validator.addMethod("maxsize",function(e,t,r){var a=r,r=this.optional(t);let i,o;if(r)return r;if(t.files&&t.files.length)for(i=0,o=t.files.length;i<o;i++)if(t.files[i].size>a)return!1;return!0},wpforms_settings.val_filesize),d.validator.addMethod("step",function(e,t,r){o=r;const a=Math.floor(o)!==o&&o.toString().split(".")[1].length||0;function i(e){return Math.round(e*Math.pow(10,a))}var o=i(d(t).attr("min"));return e=i(e)-o,this.optional(t)||i(e)%i(r)==0}),d.validator.methods.email=function(e,t){return this.optional(t)||function(e){if("string"!=typeof e)return!1;var t=e.indexOf("@",1);if(e.length<6||254<e.length||-1===t)return!1;if(-1!==e.indexOf("@",t+1))return!1;var[t,e]=e.split("@");if(!t||!e)return!1;if(!/^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+$/.test(t)||63<t.length)return!1;if(/\.{2,}/.test(e)||e.trim(" \t\n\r\0\v.")!==e)return!1;t=e.split(".");if(t.length<2)return!1;var r=/^[a-z0-9-]+$/i;for(const a of t)if(63<a.length||a.trim(" \t\n\r\0\v-")!==a||!r.test(a))return!1;return!0}(e)},d.validator.addMethod("restricted-email",function(e,t){var r=d(t);return!r.val().length||(r=r.closest(".wpforms-form").data("formid"),Object.prototype.hasOwnProperty.call(l.cache,r)&&Object.prototype.hasOwnProperty.call(l.cache[r],"restrictedEmailValidation")&&Object.prototype.hasOwnProperty.call(l.cache[r].restrictedEmailValidation,e)?l.cache[r].restrictedEmailValidation[e]:(l.restrictedEmailRequest(t,e),"pending"))},wpforms_settings.val_email_restricted),d.validator.addMethod("confirm",function(e,t,r){t=d(t).closest(".wpforms-field");return d(t.find("input")[0]).val()===d(t.find("input")[1]).val()},wpforms_settings.val_confirm),d.validator.addMethod("required-payment",function(e,t){return 0<l.amountSanitize(e)},wpforms_settings.val_requiredpayment),d.validator.addMethod("time12h",function(e,t){return this.optional(t)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(e)},wpforms_settings.val_time12h),d.validator.addMethod("time24h",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(\ ?[AP]M)?$/i.test(e)},wpforms_settings.val_time24h),d.validator.addMethod("turnstile",function(e){return e},wpforms_settings.val_turnstile_fail_msg),d.validator.addMethod("time-limit",function(e,t){var t=d(t),r=t.data("min-time");return void 0===r||!(t.prop("required")||!l.empty(e))||(t=t.data("max-time"),l.compareTimesGreaterThan(t,r)?l.compareTimesGreaterThan(e,r)&&l.compareTimesGreaterThan(t,e):l.compareTimesGreaterThan(e,r)&&l.compareTimesGreaterThan(e,t)||l.compareTimesGreaterThan(r,e)&&l.compareTimesGreaterThan(t,e))},function(e,t){t=d(t);let r=t.data("min-time"),a=t.data("max-time");return r=r.replace(/^00:([0-9]{2})pm$/,"12:$1pm"),a=a.replace(/^00:([0-9]{2})pm$/,"12:$1pm"),r=r.replace(/(am|pm)/g," $1").toUpperCase(),a=a.replace(/(am|pm)/g," $1").toUpperCase(),wpforms_settings.val_time_limit.replace("{minTime}",r).replace("{maxTime}",a)}),d.validator.addMethod("check-limit",function(e,t){var t=d(t).closest("ul"),r=parseInt(t.attr("data-choice-limit")||0,10);return 0===r||t.find('input[type="checkbox"]:checked').length<=r},function(e,t){t=parseInt(d(t).closest("ul").attr("data-choice-limit")||0,10);return wpforms_settings.val_checklimit.replace("{#}",t)}),void 0!==p.intlTelInput&&d.validator.addMethod("smart-phone-field",function(e,t){var r;return!e.match(/[^\d()\-+\s]/)&&(e=p.intlTelInputGlobals?.getInstance(t),r=d(t).triggerHandler("validate"),this.optional(t)||e?.isValidNumberPrecise()||r)},wpforms_settings.val_phone),d.validator.addMethod("inputmask-incomplete",function(e,t){return 0===e.length||void 0===d.fn.inputmask||d(t).inputmask("isComplete")},wpforms_settings.val_inputmask_incomplete),d.validator.addMethod("required-positive-number",function(e,t){return 0<l.amountSanitize(e)},wpforms_settings.val_number_positive),d.validator.addMethod("required-minimum-price",function(e,t,r){t=d(t);return""===e&&!t.hasClass("wpforms-field-required")||Number(l.amountSanitize(l.amountFormat(r)))<=Number(l.amountSanitize(e))},wpforms_settings.val_minimum_price),d.validator.addMethod("us-phone-field",function(e,t){return!e.match(/[^\d()\-+\s]/)&&(this.optional(t)||10===e.replace(/[^\d]/g,"").length)},wpforms_settings.val_phone),d.validator.addMethod("int-phone-field",function(e,t){return!e.match(/[^\d()\-+\s]/)&&(this.optional(t)||0<e.replace(/[^\d]/g,"").length)},wpforms_settings.val_phone),d.validator.addMethod("password-strength",function(e,t){var r=d(t),t=WPFormsPasswordField.passwordStrength(e,t);return""===e&&!r.hasClass("wpforms-field-required")||t>=Number(r.data("password-strength-level"))},wpforms_settings.val_password_strength),d(".wpforms-validate").each(function(){var e=d(this),t=e.data("formid");let r;r=void 0!==p["wpforms_"+t]&&p["wpforms_"+t].hasOwnProperty("validate")?p["wpforms_"+t].validate:"undefined"!=typeof wpforms_validate?wpforms_validate:{errorElement:l.isModernMarkupEnabled()?"em":"label",errorClass:"wpforms-error",validClass:"wpforms-valid",ignore:":hidden:not(textarea.wp-editor-area), .wpforms-conditional-hide textarea.wp-editor-area",ignoreTitle:!0,errorPlacement(e,t){l.isLikertScaleField(t)?(t.closest("table").hasClass("single-row")?t.closest(".wpforms-field"):t.closest("tr").find("th")).append(e):l.isWrappedField(t)?t.closest(".wpforms-field").append(e):l.isDateTimeField(t)?l.dateTimeErrorPlacement(t,e):l.isFieldInColumn(t)||l.isFieldHasHint(t)?t.parent().append(e):l.isLeadFormsSelect(t)?t.parent().parent().append(e):t.hasClass("wp-editor-area")?t.parent().parent().parent().append(e):e.insertAfter(t),l.isModernMarkupEnabled()&&e.attr({role:"alert","aria-label":wpforms_settings.errorMessagePrefix,for:""})},highlight(e,t,r){var a=d(e),i=a.closest(".wpforms-field"),o=a.attr("name");("radio"===a.attr("type")||"checkbox"===a.attr("type")?i.find('input[name="'+o+'"]'):a).addClass(t).removeClass(r),"password"===a.attr("type")&&""===a.val().trim()&&p.WPFormsPasswordField&&a.data("rule-password-strength")&&a.hasClass("wpforms-field-required")&&WPFormsPasswordField.passwordStrength("",e),i.addClass("wpforms-has-error")},unhighlight(e,t,r){var e=d(e),a=e.closest(".wpforms-field"),i=e.attr("name");("radio"===e.attr("type")||"checkbox"===e.attr("type")?a.find('input[name="'+i+'"]'):e).addClass(r).removeClass(t),a.find(":input.wpforms-error,[data-dz-errormessage]:not(:empty)").length||a.removeClass("wpforms-has-error"),l.isModernMarkupEnabled()&&e.parent().find("em.wpforms-error").remove()},submitHandler(s){function n(e,t){let r="label",a="";l.isModernMarkupEnabled()&&(r="em",a='role="alert"');var i=`<${r} id="wpforms-field_recaptcha-error" class="wpforms-error" ${a}> ${wpforms_settings.val_recaptcha_fail_msg}</${r}>`;e.find(".wpforms-recaptcha-container").append(i),l.restoreSubmitButton(e,t)}function e(){const e=d(s),t=e.closest(".wpforms-container"),r=e.find(".wpforms-submit"),a=r.data("captchaInvalid"),i=r.data("alt-text"),o=r.get(0).recaptchaID;return e.data("token")&&0===d(".wpforms-token",e).length&&d('<input type="hidden" class="wpforms-token" name="wpforms[token]" />').val(e.data("token")).appendTo(e),e.find("#wpforms-field_recaptcha-error").remove(),r.prop("disabled",!0),WPFormsUtils.triggerEvent(e,"wpformsFormSubmitButtonDisable",[e,r]),i&&r.text(i),a?n(e,t):l.empty(o)&&0!==o?(d(".wpforms-input-temp-name").removeAttr("name"),void l.formSubmit(e)):(grecaptcha.execute(o).then(null,function(){grecaptcha.getResponse()||n(e,t)}),!1)}return"function"==typeof wpformsRecaptchaV3Execute?wpformsRecaptchaV3Execute(e):e()},invalidHandler(e,t){void 0!==t.errorList[0]&&l.scrollToError(d(t.errorList[0].element))},onkeyup:WPFormsUtils.debounce(function(e,t){d(e).hasClass("wpforms-novalidate-onkeyup")||9===t.which&&""===this.elementValue(e)||-1!==d.inArray(t.keyCode,[16,17,18,20,35,36,37,38,39,40,45,144,225])||(e.name in this.submitted||e.name in this.invalid)&&this.element(e)},1e3),onfocusout:function(e){let t=!1;d(e).hasClass("wpforms-novalidate-onkeyup")&&!e.value&&(t=!0),this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||(t=!0),(t=d(e).data("server-error")?!1:t)&&this.element(e)},onclick(e){let t=!1;var r=(e||{}).type;let a=d(e);-1<["checkbox","radio"].indexOf(r)&&((a=a.hasClass("wpforms-likert-scale-option")?a.closest("tr"):a.closest(".wpforms-field")).find("label.wpforms-error, em.wpforms-error").remove(),t=!0),t&&this.element(e)}},e.validate(r)}))},restrictedEmailRequest(r,a){var e=d(r),t=e.closest("form");const i=t.data("validator"),o=t.data("formid");t=e.closest(".wpforms-field").data("field-id");l.cache[o]=l.cache[o]||{},i.startRequest(r),d.post({url:wpforms_settings.ajaxurl,type:"post",data:{action:"wpforms_restricted_email",form_id:o,field_id:t,email:a},dataType:"json",success(e){var t={},e=e.success&&e.data;e||(t[r.name]=wpforms_settings.val_email_restricted,i.showErrors(t)),l.cache[o].restrictedEmailValidation=l.cache[o].restrictedEmailValidation||[],Object.prototype.hasOwnProperty.call(l.cache[o].restrictedEmailValidation,a)||(l.cache[o].restrictedEmailValidation[a]=e),i.stopRequest(r,e)}})},isFieldInColumn(e){return e.parent().hasClass("wpforms-one-half")||e.parent().hasClass("wpforms-two-fifths")||e.parent().hasClass("wpforms-one-fifth")},isFieldHasHint(e){return 0<e.nextAll(".wpforms-field-sublabel, .wpforms-field-description, .wpforms-field-limit-text, .wpforms-pass-strength-result").length},isDateTimeField(e){return e.hasClass("wpforms-timepicker")||e.hasClass("wpforms-datepicker")||e.is("select")&&e.attr("class").match(/date-month|date-day|date-year/)},isWrappedField(e){return"checkbox"===e.attr("type")||"radio"===e.attr("type")||"range"===e.attr("type")||"select"===e.is("select")||1===e.data("is-wrapped-field")||e.parent().hasClass("iti")||e.hasClass("wpforms-validation-group-member")||e.hasClass("choicesjs-select")||e.hasClass("wpforms-net-promoter-score-option")||e.hasClass("wpforms-field-payment-coupon-input")},isLikertScaleField(e){return e.hasClass("wpforms-likert-scale-option")},isLeadFormsSelect(e){return e.parent().hasClass("wpforms-lead-forms-select")},isCoupon(e){return console.warn('WARNING! Function "wpforms.isCoupon( element )" has been deprecated'),e.closest(".wpforms-field").hasClass("wpforms-field-payment-coupon")},dateTimeErrorPlacement(e,t){var r=e.closest(".wpforms-field-row-block, .wpforms-field-date-time");r.length?r.find("label.wpforms-error, em.wpforms-error").length||r.append(t):e.closest(".wpforms-field").append(t)},loadDatePicker(e){void 0!==d.fn.flatpickr&&(e=e?.length?e:d(s)).find(".wpforms-datepicker-wrap").each(function(){const a=d(this),e=a.find("input"),t=a.closest(".wpforms-form"),r=t.data("formid"),i=a.closest(".wpforms-field").data("field-id");let o;var s;!(o=void 0!==p["wpforms_"+r+"_"+i]&&p["wpforms_"+r+"_"+i].hasOwnProperty("datepicker")?p["wpforms_"+r+"_"+i].datepicker:void 0!==p["wpforms_"+r]&&p["wpforms_"+r].hasOwnProperty("datepicker")?p["wpforms_"+r].datepicker:"undefined"!=typeof wpforms_datepicker?wpforms_datepicker:{disableMobile:!0}).hasOwnProperty("locale")&&"undefined"!=typeof wpforms_settings&&wpforms_settings.hasOwnProperty("locale")&&(o.locale=wpforms_settings.locale),o.wrap=!0,o.dateFormat=e.data("date-format"),1===e.data("disable-past-dates")&&(o.minDate="today",1===e.data("disable-todays-date"))&&(s=new Date,o.minDate=s.setDate(s.getDate()+1));let n=e.data("limit-days");const l=["sun","mon","tue","wed","thu","fri","sat"];n&&""!==n&&(n=n.split(","),o.disable=[function(e){for(const t in n)if(l.indexOf(n[t])===e.getDay())return!1;return!0}]),o.onChange=function(e,t,r){a.find(".wpforms-datepicker-clear").css("display",""===t?"none":"block")},a.flatpickr(o)})},loadTimePicker(e){void 0!==d.fn.timepicker&&(e=e?.length?e:d(s)).find(".wpforms-timepicker").each(function(){var e=d(this),t=e.closest(".wpforms-form").data("formid"),r=e.closest(".wpforms-field").data("field-id");let a;a=void 0!==p["wpforms_"+t+"_"+r]&&p["wpforms_"+t+"_"+r].hasOwnProperty("timepicker")?p["wpforms_"+t+"_"+r].timepicker:void 0!==p["wpforms_"+t]&&p["wpforms_"+t].hasOwnProperty("timepicker")?p["wpforms_"+t].timepicker:"undefined"!=typeof wpforms_timepicker?wpforms_timepicker:{scrollDefault:"now",forceRoundTime:!0};r=e.val();e.timepicker(a),r&&(e.val(r),e.trigger("changeTime"))})},loadInputMask(e){void 0!==d.fn.inputmask&&(e=e?.length?e:d(s)).find(".wpforms-masked-input").inputmask({rightAlign:!1})},fixPhoneFieldSnippets(t){console.warn("WARNING! Obsolete function called. Function wpforms.fixPhoneFieldSnippets( $field ) has been deprecated, please use the wpforms.repairSmartPhoneHiddenField( $field ) function instead!"),t.siblings('input[type="hidden"]').each(function(){var e;d(this).attr("name").includes("function")&&(e=(e=t.data("plugin_intlTelInput")).d||e.options)&&(p.intlTelInputGlobals.getInstance(t[0]).destroy(),e.initialCountry=e.initialCountry.toLowerCase(),e.onlyCountries=e.onlyCountries.map(e=>e.toLowerCase()),e.preferredCountries=e.preferredCountries.map(e=>e.toLowerCase()),p.intlTelInput(t[0],e),t.siblings('input[type="hidden"]').each(function(){var e=d(this);e.attr("name",e.attr("name").replace("wpf-temp-",""))}))})},repairSmartPhoneHiddenField(r){var a=r.closest(".wpforms-field-phone").data("field-id");if(!d('[name="wpforms[fields]['+a+']"]').length){a=r.data("plugin_intlTelInput");let e=r.val(),t={};a&&(t=a.d||a.options||{},e=a.getNumber(),a.destroy()),r.removeData("plugin_intlTelInput"),r.val(e),l.initSmartPhoneField(r,t)}},getDefaultSmartPhoneFieldOptions(){var e,t={countrySearch:!1,fixDropdownWidth:!1,preferredCountries:["us","gb"],countryListAriaLabel:wpforms_settings.country_list_label};wpforms_settings.gdpr||(t.geoIpLookup=l.currentIpToCountry);let r;if(wpforms_settings.gdpr&&(e=l.mapLanguageToIso(this.getFirstBrowserLanguage()),r=-1<e.indexOf("-")?e.split("-").pop():e),r){let e=p.intlTelInputGlobals.getCountryData();e=e.filter(function(e){return e.iso2===r.toLowerCase()}),r=e.length?r:""}return t.initialCountry=wpforms_settings.gdpr&&r?r.toLowerCase():"auto",t},loadSmartPhoneField(e){void 0!==p.intlTelInput&&(l.loadJqueryIntlTelInput(),(e=e?.length?e:d(s)).find(".wpforms-smart-phone-field").each(function(e,t){t=d(t);if(t.parents(".elementor-location-popup").is(":hidden"))return!1;l.initSmartPhoneField(t,{})}))},loadJqueryIntlTelInput(){void 0===d.fn.intlTelInput&&d.fn.extend({intlTelInput(a){var e=d(this);if(void 0===a||"object"==typeof a)return e.each(function(){var e,t=d(this);t.data("plugin_intlTelInput")||(e=p.intlTelInput(t.get(0),a),t.data("plugin_intlTelInput",e))});if("string"==typeof a||"_"!==a[0]){const i=a;let r=this;return e.each(function(){var e=d(this),t=e.data("plugin_intlTelInput");"function"==typeof t[i]&&(r=t[i](),"destroy"===a)&&e.removeData("plugin_intlTelInput")}),r}}})},initSmartPhoneField(t,e){if("object"!=typeof t.data("plugin_intlTelInput")){e=0<Object.keys(e).length?e:l.getDefaultSmartPhoneFieldOptions();const r=t.closest(".wpforms-field-phone").data("field-id"),a=(e.hiddenInput=function(){return{phone:"wpforms[fields]["+r+"]"}},e.utilsScript=wpforms_settings.wpforms_plugin_url+"assets/pro/lib/intl-tel-input/module.intl-tel-input-utils.min.js",p.intlTelInput(t.get(0),e));t.on("validate",function(){return a.isValidNumber(a.getNumber())}),t.data("plugin_intlTelInput",a),t.attr("name","wpf-temp-wpforms[fields]["+r+"]"),t.addClass("wpforms-input-temp-name"),t.on("blur input",function(){var e=t.data("plugin_intlTelInput");t.siblings('input[type="hidden"]').val(e.getNumber())})}},bindSmartPhoneField(){d(".wpforms-form").on("wpformsBeforeFormSubmit",function(){var e=d(this).find(".wpforms-smart-phone-field");e.each(function(){l.repairSmartPhoneHiddenField(d(this))}),e.trigger("input")})},loadPayments(){d(".wpforms-payment-total").each(function(e,t){l.amountTotal(this)}),void 0!==d.fn.payment&&(d(".wpforms-field-credit-card-cardnumber").payment("formatCardNumber"),d(".wpforms-field-credit-card-cardcvc").payment("formatCardCVC"))},loadMailcheck(){wpforms_settings.mailcheck_enabled&&void 0!==d.fn.mailcheck&&(0<wpforms_settings.mailcheck_domains.length&&(Mailcheck.defaultDomains=Mailcheck.defaultDomains.concat(wpforms_settings.mailcheck_domains)),0<wpforms_settings.mailcheck_toplevel_domains.length&&(Mailcheck.defaultTopLevelDomains=Mailcheck.defaultTopLevelDomains.concat(wpforms_settings.mailcheck_toplevel_domains)),d(s).on("blur",".wpforms-field-email input",function(){const e=d(this),i=e.attr("id");e.mailcheck({suggested(e,t){t.full=t.full.replace(/%(?![0-9][0-9a-fA-F]+)/g,"%25"),t.address=t.address.replace(/%(?![0-9][0-9a-fA-F]+)/g,"%25"),t.domain=t.domain.replace(/%(?![0-9][0-9a-fA-F]+)/g,"%25"),t.address.match(/^xn--/)&&(t.full=punycode.toUnicode(decodeURI(t.full)),r=t.full.split("@"),t.address=r[0],t.domain=r[1]),t.domain.match(/^xn--/)&&(t.domain=punycode.toUnicode(decodeURI(t.domain)));var r=decodeURI(t.address).replaceAll(/[<>'"()/\\|:;=@%&\s]/gi,"").substr(0,64),a=decodeURI(t.domain).replaceAll(/[<>'"()/\\|:;=@%&+_\s]/gi,"");t='<a href="#" class="mailcheck-suggestion" data-id="'+i+'" title="'+wpforms_settings.val_email_suggestion_title+'">'+r+"@"+a+"</a>",t=wpforms_settings.val_email_suggestion.replace("{suggestion}",t),e.closest(".wpforms-field").find("#"+i+"_suggestion").remove(),e.parent().append('<label class="wpforms-error mailcheck-error" id="'+i+'_suggestion">'+t+"</label>")},empty(){d("#"+i+"_suggestion").remove()}})}),d(s).on("click",".wpforms-field-email .mailcheck-suggestion",function(e){var t=d(this),r=t.closest(".wpforms-field"),a=t.data("id");e.preventDefault(),r.find("#"+a).val(t.text()),t.parent().remove()}))},loadChoicesJS(o){"function"==typeof p.Choices&&(o=o?.length?o:d(s)).find(".wpforms-field-select-style-modern .choicesjs-select, .wpforms-field-payment-select .choicesjs-select").each(function(e,t){var r,a,i;d(t).data("choicesjs")||WPFormsUtils.triggerEvent(o,"wpformsBeforeLoadElementChoices",[t]).isDefaultPrevented()||(r=p.wpforms_choicesjs_config||{},a=d(t).data("search-enabled"),i=d(t).data("remove-items-enabled"),r.searchEnabled=void 0===a||a,r.removeItems=void 0===i||i,r.removeItemButton=r.removeItems,r.searchEnabled=void 0===a||a,r.allowHTML=!0,r.callbackOnInit=function(){const t=this,r=d(t.passedElement.element),a=d(t.input.element),e=r.data("size-class");r.removeAttr("hidden").addClass(t.config.classNames.input+"--hidden"),e&&d(t.containerOuter.element).addClass(e),r.prop("multiple")&&(a.data("placeholder",a.attr("placeholder")).css("width","auto"),t.getValue(!0).length&&a.removeAttr("placeholder"),a.css("width","1ch")),r.on("change",function(){r.prop("multiple")&&(t.getValue(!0).length?a.removeAttr("placeholder"):a.attr("placeholder",a.data("placeholder")).css("width","auto"));var e=r.closest("form").data("validator");e&&e.element(r)})},r.callbackOnCreateTemplates=function(){const r=d(this.passedElement.element);return{option(e){var t=Choices.defaults.templates.option.call(this,e);return void 0!==e.placeholder&&!0===e.placeholder&&t.classList.add("placeholder"),r.hasClass("wpforms-payment-price")&&void 0!==e.customProperties&&null!==e.customProperties&&(t.dataset.amount=e.customProperties),t}}},d(t).data("choicesjs",new Choices(t,r)))})},bindChoicesJS(){d(s).on("click",".choices",function(e){var t=d(this),r=t.find("select").data("choicesjs");r&&t.hasClass("is-open")&&(e.target.classList.contains("choices__inner")||e.target.classList.contains("choices__arrow"))&&r.hideDropdown()})},bindUIActions(){var e=d(s);e.on("click",".wpforms-page-button",function(e){e.preventDefault(),l.pagebreakNav(this)}),e.on("change input",".wpforms-payment-price",function(){l.amountTotal(this,!0)}),e.on("change input","select.wpforms-payment-quantity",function(){l.amountTotal(this,!0),l.updateOrderSummaryItemQuantity(d(this))}),e.on("input",".wpforms-payment-user-input",function(){var e=d(this),t=e.val();e.val(t.replace(/[^0-9.,]/g,""))}),e.on("focusout",".wpforms-payment-user-input",function(){var e=d(this),t=e.val();if(!t)return t;t=l.amountSanitize(t),t=l.amountFormat(t);e.val(t)}),e.on("wpformsProcessConditionals",function(e,t){l.amountTotal(t,!0)}),e.on("mouseenter",".wpforms-field-rating-item",function(){d(this).parent().find(".wpforms-field-rating-item").removeClass("selected hover"),d(this).prevAll().addBack().addClass("hover")}).on("mouseleave",".wpforms-field-rating-item",function(){d(this).parent().find(".wpforms-field-rating-item").removeClass("selected hover"),d(this).parent().find("input:checked").parent().prevAll().addBack().addClass("selected")}),d(s).on("change",".wpforms-field-rating-item input",function(){var e=d(this),t=e.closest(".wpforms-field-rating-items").find(".wpforms-field-rating-item");e.focus(),t.removeClass("hover selected"),e.parent().prevAll().addBack().addClass("selected")}),d(function(){d(".wpforms-field-rating-item input:checked").trigger("change")}),e.on("keydown",".wpforms-image-choices-item label",function(e){var t=d(this);if(t.closest(".wpforms-field").hasClass("wpforms-conditional-hide"))return e.preventDefault(),!1;32===e.keyCode&&(t.find("input").trigger("click"),e.preventDefault())}),p.document.documentMode&&e.on("click",".wpforms-image-choices-item img",function(){d(this).closest("label").find("input").trigger("click")}),e.on("change",".wpforms-field-checkbox input, .wpforms-field-radio input, .wpforms-field-payment-multiple input, .wpforms-field-payment-checkbox input, .wpforms-field-gdpr-checkbox input",function(e){var t=d(this);if(t.closest(".wpforms-field").hasClass("wpforms-conditional-hide"))return e.preventDefault(),!1;switch(t.attr("type")){case"radio":t.closest("ul").find("li").removeClass("wpforms-selected").find("input[type=radio]").removeProp("checked"),t.prop("checked",!0).closest("li").addClass("wpforms-selected");break;case"checkbox":t.is(":checked")?(t.closest("li").addClass("wpforms-selected"),t.prop("checked",!0)):(t.closest("li").removeClass("wpforms-selected"),t.prop("checked",!1))}}),e.on("input",".wpforms-field-file-upload",function(){var e=d(this),t=e.closest("form.wpforms-form").find('.wpforms-field-file-upload input:not(".dropzone-input")');let a=0,r=Number(wpforms_settings.post_max_size),i='<div class="wpforms-error-container-post_max_size">'+wpforms_settings.val_post_max_size+"</div>";e=e.closest("form.wpforms-form").find(".wpforms-submit-container");let o=e.find("button.wpforms-submit"),s=e.prev();var n=o.closest("form"),l=n.find(".wpforms-page-next:visible");0!==n.find(".wpforms-page-indicator").length&&0!==l.length&&(o=l),t.each(function(){var e=d(this);let t=0;for(var r=e[0].files.length;t<r;t++)a+=e[0].files[t].size}),a<r?(s.find(".wpforms-error-container-post_max_size").remove(),o.prop("disabled",!1),WPFormsUtils.triggerEvent(n,"wpformsFormSubmitButtonRestore",[n,o]),WPFormsUtils.triggerEvent(n,"wpformsCombinedUploadsSizeOk",[n,s])):(a=Number((a/1048576).toFixed(3)),r=Number((r/1048576).toFixed(3)),i=i.replace(/{totalSize}/,a).replace(/{maxSize}/,r),s.hasClass("wpforms-error-container")?(s.find(".wpforms-error-container-post_max_size").remove(),s.append(i)):(e.before('<div class="wpforms-error-container">{errorMsg}</div>'.replace(/{errorMsg}/,i)),s=e.prev()),o.prop("disabled",!0),WPFormsUtils.triggerEvent(n,"wpformsFormSubmitButtonDisable",[n,o]),WPFormsUtils.triggerEvent(n,"wpformsCombinedUploadsSizeError",[n,s]))}),e.on("change input",".wpforms-field-number-slider input[type=range]",function(e){var t=d(e.target).siblings(".wpforms-field-number-slider-hint");t.html(t.data("hint").replaceAll("{value}","<b>"+e.target.value+"</b>"))}),e.on("keydown",".wpforms-form input",function(e){var t,r;13!==e.keyCode||0===(r=(t=d(this)).closest(".wpforms-page")).length||["text","tel","number","email","url","radio","checkbox"].indexOf(t.attr("type"))<0||(t.hasClass("wpforms-datepicker")&&t.flatpickr("close"),e.preventDefault(),(r.hasClass("last")?r.closest(".wpforms-form").find(".wpforms-submit"):r.find(".wpforms-page-next")).trigger("click"))}),e.on("keypress",".wpforms-field-number input",function(e){return/^[-0-9.]+$/.test(String.fromCharCode(e.keyCode||e.which))}),e.one("input",".wpforms-field input, .wpforms-field textarea, .wpforms-field select",l.formChanged).one("change",".wpforms-field-select-style-modern, .wpforms-timepicker",l.formChanged).one("focus",".dropzone-input",l.formChanged).one("click touchstart",".wpforms-signature-canvas",l.formChanged).one("wpformsRichTextContentChange",l.richTextContentChanged),d("form.wpforms-form").on("wpformsBeforePageChange",l.skipEmptyPages)},skipEmptyPages(e,t,r,a){var i=l.findNonEmptyPage(t,r,a);i!==t&&(e.preventDefault(),1===i&&"prev"===a?(e=r.find(".wpforms-page-2"),a=r.find(".wpforms-page-"+t),t=(e.find(".wpforms-page-prev").length?e:a).find(".wpforms-page-prev"),wpforms.navigateToPage(t,"prev",2,r,e)):(t=r.find(".wpforms-page-"+(a=i-1)),wpforms.navigateToPage(t.find(".wpforms-page-next"),"next",a,r,t)))},findNonEmptyPage(e,t,r){let a=e;for(;l.isEmptyPage(t,a);)"prev"===r?a--:a++;return a},isEmptyPage(e,t){return 1!==t&&!(e=e.find(".wpforms-page-"+t)).hasClass("last")&&(t=e.find(".wpforms-field:not(.wpforms-field-pagebreak):not(.wpforms-field-hidden)"),e.find(".wpforms-conditional-hide").length===t.length)},formChanged(e){var t=d(this).closest(".wpforms-form");l.maybeSetStartTime(t)},richTextContentChanged(e,t,r){r=r.getContainer(),r=d(r).closest(".wpforms-form");l.maybeSetStartTime(r)},initFormsStartTime(){d(".wpforms-form").each(function(){l.maybeSetStartTime(d(this))})},maybeSetStartTime(e){e.data("start_timestamp")||e.data("start_timestamp",Date.now())},entryPreviewFieldPageChange(e,t,r){console.warn("WARNING! Obsolete function called. Function wpforms.entryPreviewFieldPageChange has been deprecated, please use the WPFormsEntryPreview.pageChange function instead!"),WPFormsEntryPreview.pageChange(e,t,r)},entryPreviewFieldUpdate(e,t){console.warn("WARNING! Obsolete function called. Function wpforms.entryPreviewFieldUpdate has been deprecated, please use the WPFormsEntryPreview.update function instead!"),WPFormsEntryPreview.update(e,t)},scrollToError(e){if(0!==e.length){let t=e.find(".wpforms-field.wpforms-has-error");0!==(t=0===t.length?e.closest(".wpforms-field"):t).length&&void 0!==(e=t.offset())&&l.animateScrollTop(e.top-75,750).done(function(){var e=t.find(".wpforms-error").first();"function"==typeof e.focus&&e.trigger("focus")})}},pagebreakNav(e){const t=d(e),r=t.data("action"),a=t.data("page"),i=t.closest(".wpforms-form"),o=i.find(".wpforms-page-"+a);l.saveTinyMCE(),"next"===r&&void 0!==d.fn.validate?l.checkForInvalidFields(i,o,function(){l.navigateToPage(t,r,a,i,o)}):"prev"!==r&&"next"!==r||l.navigateToPage(t,r,a,i,o)},checkForInvalidFields(e,t,r){var a=e.data("validator");if(a)if(0<a.pendingRequest)setTimeout(function(){l.checkForInvalidFields(e,t,r)},800);else{let a=!0;t.find(":input").each(function(e,t){var r=d(t);!r.attr("name")||r.hasClass("wpforms-field-skip-validation")||d(t).valid()||(a=!1)}),a?r():l.scrollToError(t)}},navigateToPage(t,r,a,i,e){if(!t.hasClass("wpforms-disabled")){let e=a;"next"===r?e+=1:"prev"===r&&--e,WPFormsUtils.triggerEvent(t,"wpformsBeforePageChange",[e,i,r]).isDefaultPrevented()||(i.find(".wpforms-page").hide(),(a=i.find(".wpforms-page-"+e)).show(),l.toggleReCaptchaAndSubmitDisplay(i,r,a),l.checkTurnstileVisibility(i),(a=l.getPageScroll(i))&&l.animateScrollTop(i.offset().top-a,750,null),t.trigger("wpformsPageChange",[e,i,r]),l.manipulateIndicator(e,i))}},toggleReCaptchaAndSubmitDisplay(e,t,r){var a=e.find(".wpforms-submit-container"),e=e.find(".wpforms-recaptcha-container");"next"===t&&r.hasClass("last")?(e.show(),a.show()):"prev"===t&&(e.hide(),a.hide())},checkTurnstileVisibility(e){var t,e=e.find(".wpforms-recaptcha-container");e.hasClass("wpforms-is-turnstile")&&(t=e.find(".g-recaptcha").height(),0===parseInt(t,10)?e.addClass("wpforms-is-turnstile-invisible"):e.removeClass("wpforms-is-turnstile-invisible"))},getPageScroll(e){return!1!==p.wpforms_pageScroll&&(l.empty(p.wpform_pageScroll)?0!==e.find(".wpforms-page-indicator").data("scroll")&&75:p.wpform_pageScroll)},manipulateIndicator(e,t){var r,a=t.find(".wpforms-page-indicator");a&&("connector"===(r=a.data("indicator"))||"circles"===r?l.manipulateConnectorAndCirclesIndicator(a,r,e):"progress"===r&&l.manipulateProgressIndicator(a,t,e))},manipulateConnectorAndCirclesIndicator(e,t,r){var a=e.data("indicator-color");e.find(".wpforms-page-indicator-page").removeClass("active"),e.find(".wpforms-page-indicator-page-"+r).addClass("active"),e.find(".wpforms-page-indicator-page-number").removeAttr("style"),e.find(".active .wpforms-page-indicator-page-number").css("background-color",a),"connector"===t&&(e.find(".wpforms-page-indicator-page-triangle").removeAttr("style"),e.find(".active .wpforms-page-indicator-page-triangle").css("border-top-color",a))},manipulateProgressIndicator(e,t,r){var a=e.find(".wpforms-page-indicator-page-title"),i=e.find(".wpforms-page-indicator-page-title-sep"),t=r/t.find(".wpforms-page").length*100;e.find(".wpforms-page-indicator-page-progress").css("width",t+"%"),e.find(".wpforms-page-indicator-steps-current").text(r),a.data("page-"+r+"-title")?(a.css("display","inline").text(a.data("page-"+r+"-title")),i.css("display","inline")):(a.css("display","none"),i.css("display","none"))},bindOptinMonster(){s.addEventListener("om.Campaign.load",function(e){l.ready(),l.optinMonsterRecaptchaReset(e.detail.Campaign.data.id)}),s.addEventListener("om.Campaign.afterShow",function(e){"undefined"!=typeof WPFormsRepeaterField&&WPFormsRepeaterField.ready()}),d(s).on("OptinMonsterOnShow",function(e,t,r){l.ready(),l.optinMonsterRecaptchaReset(t.optin),"undefined"!=typeof WPFormsRepeaterField&&WPFormsRepeaterField.ready()})},optinMonsterRecaptchaReset(e){var e=d("#om-"+e).find(".wpforms-form"),t=e.find(".wpforms-recaptcha-container"),r=e.find(".g-recaptcha");if(e.length&&r.length){const a=r.attr("data-sitekey"),i="recaptcha-"+Date.now(),o=t.hasClass("wpforms-is-hcaptcha")?hcaptcha:grecaptcha;r.remove(),t.prepend('<div class="g-recaptcha" id="'+i+'" data-sitekey="'+a+'"></div>'),o.render(i,{sitekey:a,callback(){wpformsRecaptchaCallback(d("#"+i))}})}},amountTotal(e,t){t=t||!1;const r=d(e),a=r.closest(".wpforms-form"),i=l.amountTotalCalc(a);if(l.allowAmountTotalCalc(a,r,i)){const o=l.amountFormatSymbol(i);a.find(".wpforms-payment-total").each(function(){"hidden"===d(this).attr("type")||"text"===d(this).attr("type")?(d(this).val(o),"text"===d(this).attr("type")&&t&&a.data("validator")&&d(this).valid()):d(this).text(o)}),l.updateOrderSummaryItems(a,r,o)}},allowAmountTotalCalc(e,t,r){var e=e.data("formid");return l.getCache(e,"amountTotal")!==r?(l.updateCache(e,"amountTotal",r),!0):"radio"===(e=t.prop("type"))||"select-one"===e},updateOrderSummaryItems(t,e,r){t.find(".wpforms-order-summary-preview").each(function(){const e=d(this);""!==r&&e.find(".wpforms-order-summary-preview-total .wpforms-order-summary-item-price").text(r),t.find(".wpforms-payment-price").each(function(){l.updateOrderSummaryItem(d(this),e)})})},updateCache(e,t,r){l.cache[e]=l.cache[e]||{},l.cache[e][t]=r},getCache(e,t){return!(!Object.prototype.hasOwnProperty.call(l.cache,e)||!Object.prototype.hasOwnProperty.call(l.cache[e],t))&&l.cache[e][t]},updateOrderSummaryItem(e,t){if(e.hasClass("wpforms-payment-price")){const i=e.closest(".wpforms-field"),o=i.data("field-id"),s=e.prop("type"),n="block"===i.css("display");var r,a;"checkbox"===s||"radio"===s||"select-one"===s?t.find(`tr[data-field="${o}"]`).each(function(){var e=d(this).data("choice"),e="select-one"===s?e===parseInt(i.find("select").val(),10):i.find(`input[value="${e}"]`).is(":checked");d(this).toggle(n&&e)}):(r=t.find(`tr[data-field="${o}"]`),a=e.val(),r.find(".wpforms-order-summary-item-price").text(l.amountFormatSymbol(l.amountSanitize(a))),r.toggle(n)),i.hasClass("wpforms-payment-quantities-enabled")?l.updateOrderSummaryItemQuantity(e):(l.updateSummaryPriceWidth(t),l.toggleSummaryPlaceholder(t))}},updateOrderSummaryItemQuantity(e){const t=e.closest(".wpforms-field"),a=t.find("input.wpforms-payment-price, select.wpforms-payment-price"),r=e.closest(".wpforms-form"),i=t.data("field-id"),o=l.getPaymentFieldQuantity(a),s=l.getPaymentFieldAmount(a),n=a.prop("type");r.find(".wpforms-order-summary-preview").each(function(){var e,t=d(this);let r;(r="checkbox"===n||"radio"===n||"select-one"===n?(e=a.val(),t.find(`tr[data-field="${i}"][data-choice="${e}"]`)):t.find(`tr[data-field="${i}"]`)).toggle(0<o),r.find(".wpforms-order-summary-item-quantity").text(o),r.find(".wpforms-order-summary-item-price").text(l.amountFormatSymbol(s*o)),l.updateSummaryPriceWidth(t),l.toggleSummaryPlaceholder(t)})},updateSummaryPriceWidth(e){var t=Math.max(e.find(".wpforms-order-summary-preview-coupon-total .wpforms-order-summary-item-price").text().length,e.find(".wpforms-order-summary-preview-total .wpforms-order-summary-item-price").text().length+3);e.find(".wpforms-order-summary-item-price").css("width",t+"ch")},toggleSummaryPlaceholder(e){var t=e.find(".wpforms-order-summary-placeholder");let r=!0;e.find(".wpforms-order-summary-field").each(function(){if("none"!==d(this).css("display"))return r=!1}),t.toggle(r)},amountTotalCalc(e){let r=0;d(".wpforms-payment-price",e).each(function(){var e,t=d(this);t.closest(".wpforms-field-payment-single").hasClass("wpforms-conditional-hide")||(e=l.getPaymentFieldAmount(t))&&(r=Number(r)+e*l.getPaymentFieldQuantity(t))});var t=d(s),a=WPFormsUtils.triggerEvent(t,"wpformsAmountTotalCalculate",[e,r]);return r=void 0!==a.result&&0<=a.result?a.result:r,WPFormsUtils.triggerEvent(t,"wpformsAmountTotalCalculated",[e,r]),r},getPaymentFieldAmount(e){var t=e.attr("type");return"text"===t||"hidden"===t?Number(l.amountSanitize(e.val())):"radio"!==t&&"checkbox"!==t||!e.is(":checked")?e.is("select")&&0<e.find("option:selected").length&&e.find("option:selected").data("amount")?Number(l.amountSanitize(e.find("option:selected").data("amount"))):0:Number(l.amountSanitize(e.data("amount")))},getPaymentFieldQuantity(e){e=e.attr("id"),e=d(`#${e}-quantity`);return e.length?Number(e.val()):1},amountSanitize(e){var t=l.getCurrency();return e=e.toString().replace(t.symbol,"").replace(/[^0-9.,]/g,""),","===t.decimal_sep?("."===t.thousands_sep&&-1!==e.indexOf(t.thousands_sep)?e=e.replace(new RegExp("\\"+t.thousands_sep,"g"),""):""===t.thousands_sep&&-1!==e.indexOf(".")&&(e=e.replace(/\./g,"")),e=e.replace(t.decimal_sep,".")):","===t.thousands_sep&&-1!==e.indexOf(t.thousands_sep)&&(e=e.replace(new RegExp("\\"+t.thousands_sep,"g"),"")),l.numberFormat(e,t.decimals,".","")},amountFormat(e){var t,r=l.getCurrency();return e=String(e),","===r.decimal_sep&&-1!==e.indexOf(r.decimal_sep)&&(t=e.indexOf(r.decimal_sep),e=e.substr(0,t)+"."+e.substr(t+1,e.length-1)),","===r.thousands_sep&&-1!==e.indexOf(r.thousands_sep)&&(e=e.replace(/,/g,"")),l.empty(e)&&(e=0),l.numberFormat(e,r.decimals,r.decimal_sep,r.thousands_sep)},amountFormatSymbol(e){var t=l.getCurrency(),e=l.amountFormat(e);return"left"===t.symbol_pos?t.symbol+e:e+" "+t.symbol},getCurrency(){var e={code:"USD",thousands_sep:",",decimals:2,decimal_sep:".",symbol:"$",symbol_pos:"left"};return void 0!==wpforms_settings.currency_code&&(e.code=wpforms_settings.currency_code),void 0!==wpforms_settings.currency_thousands&&(e.thousands_sep=wpforms_settings.currency_thousands),void 0!==wpforms_settings.currency_decimals&&(e.decimals=wpforms_settings.currency_decimals),void 0!==wpforms_settings.currency_decimal&&(e.decimal_sep=wpforms_settings.currency_decimal),void 0!==wpforms_settings.currency_symbol&&(e.symbol=wpforms_settings.currency_symbol),void 0!==wpforms_settings.currency_symbol_pos&&(e.symbol_pos=wpforms_settings.currency_symbol_pos),e},numberFormat(e,t,r,a){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var i,o,e=isFinite(+e)?+e:0,t=isFinite(+t)?Math.abs(t):0,a=void 0===a?",":a,r=void 0===r?".":r,s=(t?(s=e,i=t,o=Math.pow(10,i),""+(Math.round(s*o)/o).toFixed(i)):""+Math.round(e)).split(".");return 3<s[0].length&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,a)),(s[1]||"").length<t&&(s[1]=s[1]||"",s[1]+=new Array(t-s[1].length+1).join("0")),s.join(r)},empty(e){var t;let r,a;var i=[void 0,null,!1,0,"","0"];for(a=0,t=i.length;a<t;a++)if(e===i[a])return!0;if("object"!=typeof e)return!1;for(r in e)if(e.hasOwnProperty(r))return!1;return!0},setUserIdentifier(){if((!p.hasRequiredConsent&&"undefined"!=typeof wpforms_settings&&wpforms_settings.uuid_cookie||p.hasRequiredConsent&&p.hasRequiredConsent())&&!l.getCookie("_wpfuuid")){var t=new Array(36),r="0123456789abcdef";for(let e=0;e<36;e++)t[e]=r.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=r.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";var e=t.join("");l.createCookie("_wpfuuid",e,3999)}},createCookie(e,t,r){let a="",i="";var o;wpforms_settings.is_ssl&&(i=";secure"),a=r?-1===r?"":((o=new Date).setTime(o.getTime()+24*r*60*60*1e3),";expires="+o.toGMTString()):";expires=Thu, 01 Jan 1970 00:00:01 GMT",s.cookie=e+"="+t+a+";path=/;samesite=strict"+i},getCookie(e){var r=e+"=",a=s.cookie.split(";");for(let t=0;t<a.length;t++){let e=a[t];for(;" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(r))return e.substring(r.length,e.length)}return null},removeCookie(e){l.createCookie(e,"",-1)},getFirstBrowserLanguage(){var e=p.navigator,t=["language","browserLanguage","systemLanguage","userLanguage"];let r,a;if(Array.isArray(e.languages))for(r=0;r<e.languages.length;r++)if((a=e.languages[r])&&a.length)return a;for(r=0;r<t.length;r++)if((a=e[t[r]])&&a.length)return a;return""},mapLanguageToIso(e){return{ar:"ar-SA",bg:"bg-BG",ca:"ca-ES",cs:"cs-CZ",da:"da-DK",de:"de-DE",el:"el-GR",en:"en-US",es:"es-ES",fi:"fi-FI",fr:"fr-FR",he:"he-IL",hi:"hi-IN",hr:"hr-HR",hu:"hu-HU",id:"id-ID",it:"it-IT",ja:"ja-JP",ko:"ko-KR",lt:"lt-LT",lv:"lv-LV",ms:"ms-MY",nl:"nl-NL",no:"nb-NO",pl:"pl-PL",pt:"pt-PT",ro:"ro-RO",ru:"ru-RU",sk:"sk-SK",sl:"sl-SI",sr:"sr-RS",sv:"sv-SE",th:"th-TH",tr:"tr-TR",uk:"uk-UA",vi:"vi-VN",zh:"zh-CN"}[e]||e},currentIpToCountry(r){if(wpforms_settings.country)r(wpforms_settings.country);else{const t=function(){d.get("https://ipapi.co/jsonp",function(){},"jsonp").always(function(e){let t=e?.country?e.country:"";t||(e=l.getFirstBrowserLanguage(),t=-1<e.indexOf("-")?e.split("-").pop():""),r(t)})};d.get("https://geo.wpforms.com/v3/geolocate/json").done(function(e){e&&e.country_iso?r(e.country_iso):t()}).fail(function(e){t()})}},formSubmit(e){e instanceof jQuery||(e=d(e)),l.saveTinyMCE(),WPFormsUtils.triggerEvent(e,"wpformsBeforeFormSubmit",[e]).isDefaultPrevented()?l.restoreSubmitButton(e,e.closest(".wpforms-container")):e.hasClass("wpforms-ajax-form")&&"undefined"!=typeof FormData?l.formSubmitAjax(e):l.formSubmitNormal(e)},restoreSubmitButton(e,t){var r=e.find(".wpforms-submit"),a=r.data("submit-text");a&&r.text(a),r.prop("disabled",!1),WPFormsUtils.triggerEvent(e,"wpformsFormSubmitButtonRestore",[e,r]),t.css("opacity",""),e.find(".wpforms-submit-spinner").hide()},formSubmitNormal(e){var t,r;e.length&&(r=(t=e.find(".wpforms-submit")).get(0).recaptchaID,l.empty(r)&&0!==r||(t.get(0).recaptchaID=!1),e.append('<input type="hidden" name="start_timestamp" value="'+e.data("start_timestamp")+'">'),e.append('<input type="hidden" name="end_timestamp" value="'+Date.now()+'">'),e.get(0).submit())},formHasCaptcha(e){return!(!e||!e.length||"undefined"==typeof hcaptcha&&"undefined"==typeof grecaptcha&&"undefined"==typeof turnstile)&&(e=e.find(".wpforms-recaptcha-container"),Boolean(e.length))},resetFormRecaptcha(r){if(l.formHasCaptcha(r)){var a=r.find(".wpforms-recaptcha-container");let e,t;e=a.hasClass("wpforms-is-hcaptcha")?hcaptcha:a.hasClass("wpforms-is-turnstile")?turnstile:grecaptcha,t=r.find(".wpforms-submit").get(0).recaptchaID,l.empty(t)&&0!==t&&(t=r.find(".g-recaptcha").data("recaptcha-id")),l.empty(t)&&0!==t||e.reset(t)}},consoleLogAjaxError(e){e?console.error("WPForms AJAX submit error:\n%s",e):console.error("WPForms AJAX submit error")},displayFormAjaxErrors(e,t){"string"==typeof t?l.displayFormAjaxGeneralErrors(e,t):(t=t&&"errors"in t?t.errors:null,l.empty(t)||l.empty(t.general)&&l.empty(t.field)?l.consoleLogAjaxError():(l.empty(t.general)||l.displayFormAjaxGeneralErrors(e,t.general),l.empty(t.field)||l.displayFormAjaxFieldErrors(e,t.field)))},displayFormAjaxGeneralErrors(e,t){var r,a;e&&e.length&&(l.empty(t)||(l.isModernMarkupEnabled()&&e.attr({"aria-invalid":"true","aria-errormessage":""}),"string"==typeof t?(a=l.isModernMarkupEnabled()?' role="alert"':"",r=l.isModernMarkupEnabled()?`<span class="wpforms-hidden">${wpforms_settings.formErrorMessagePrefix}</span>`:"",e.find(".wpforms-submit-container").before(`<div class="wpforms-error-container"${a}>${r}${t}</div>`),l.setCurrentPage(e,{})):(a=e.data("formid"),l.printGeneralErrors(e,t,a))))},printGeneralErrors(i,e,o){d.each(e,function(e,t){switch(e){case"header":case"header_styled":i.prepend(t);break;case"footer":case"footer_styled":r=t,0===i.find(".wpforms-page-indicator").length?i.find(".wpforms-submit-container").before(r):i.find(".wpforms-page-1").append(r);break;case"recaptcha":r=t,i.find(".wpforms-recaptcha-container").append(r)}var r,a;l.isModernMarkupEnabled()&&(a=i.attr("aria-errormessage")||"",i.attr("aria-errormessage",a+` wpforms-${o}-${e}-error`))}),i.find(".wpforms-error-container").length&&l.animateScrollTop(i.find(".wpforms-error-container").first().offset().top-100)},clearFormAjaxGeneralErrors(e){e.find(".wpforms-error-container").remove(),e.find("#wpforms-field_recaptcha-error").remove(),l.isModernMarkupEnabled()&&e.attr({"aria-invalid":"false","aria-errormessage":""})},displayFormAjaxFieldErrors(r,e){var t;r&&r.length&&(l.empty(e)||(t=r.data("validator"))&&(e=l.splitFieldErrors(e),d.each(e,function(e,t){d('[name="'+e+'"]',r).attr("data-server-error",t)}),t.showErrors(e),l.formHasCaptcha(r)||t.focusInvalid()))},splitFieldErrors:o=>(d.each(o,function(i,e){"string"!=typeof e&&d.each(e,function(e,t){var r=i.split("[").pop().replace("]",""),a=i.replace("["+r+"]","");r===e?o[i]=t:"string"==typeof e&&isNaN(e)&&(o[a+"["+e+"]"]=t)})}),o),formSubmitAjax:a=>{if(!a.length)return d.Deferred().reject();const r=a.closest(".wpforms-container"),e=a.find(".wpforms-submit-spinner");let i;r.css("opacity",.6),e.show(),l.clearFormAjaxGeneralErrors(a);var t=new FormData(a.get(0)),t=(t.append("action","wpforms_submit"),t.append("start_timestamp",a.data("start_timestamp")),t.append("end_timestamp",Date.now()),{type:"post",dataType:"json",url:wpforms_settings.ajaxurl,data:t,cache:!1,contentType:!1,processData:!1});return t.success=function(e){var t;if(e)if(e.data&&e.data.action_required)a.trigger("wpformsAjaxSubmitActionRequired",e);else if(e.success){if(a.trigger("wpformsAjaxSubmitSuccess",e),e.data)return e.data.redirect_url?(t=e.data.new_tab||!1,a.trigger("wpformsAjaxSubmitBeforeRedirect",e),t?(p.open(e.data.redirect_url,"_blank"),void location.reload()):void(p.location=e.data.redirect_url)):void(e.data.confirmation&&(r.html(e.data.confirmation),i=r.find("div.wpforms-confirmation-scroll"),r.trigger("wpformsAjaxSubmitSuccessConfirmation",e),i.length)&&l.animateScrollTop(i.offset().top-100))}else l.resetFormRecaptcha(a),l.displayFormAjaxErrors(a,e.data),a.trigger("wpformsAjaxSubmitFailed",e),l.setCurrentPage(a,e.data);else l.consoleLogAjaxError()},t.error=function(e,t,r){l.consoleLogAjaxError(r),a.trigger("wpformsAjaxSubmitError",[e,t,r])},t.complete=function(e,t){e.responseJSON&&e.responseJSON.data&&(e.responseJSON.data.action_required||"success"===t&&e.responseJSON.data.redirect_url)||(l.restoreSubmitButton(a,r),a.trigger("wpformsAjaxSubmitCompleted",[e,t]))},WPFormsUtils.triggerEvent(a,"wpformsAjaxBeforeSubmit",[a]).isDefaultPrevented()?(l.restoreSubmitButton(a,r),d.Deferred().reject()):d.ajax(t)},setCurrentPage(r,a){if(0!==r.find(".wpforms-page-indicator").length){const o=[];if(r.find(".wpforms-page").each(function(e,t){if(1<=d(t).find(".wpforms-has-error").length)return o.push(d(t))}),0!==o.length||void 0===a.errors||void 0===a.errors.general||void 0!==a.errors.general.footer||void 0===a.errors.general.recaptcha){var i=0<o.length?o[0]:r.find(".wpforms-page-1");let e,t="prev";1===i.data("page")||void 0!==a.errors&&void 0!==a.errors.general.footer?e=r.find(".wpforms-page-1").next():(e=0!==i.next().length?i.next():i.prev(),t=0!==i.next().length?"prev":"next");a=e.find(".wpforms-page-next"),i=e.data("page");l.navigateToPage(a,t,i,r,d(".wpforms-page-"+i))}}},animateScrollTop(e,t,r){return t=t||1e3,r="function"==typeof r?r:function(){},d("html, body").animate({scrollTop:parseInt(e,10)},{duration:t,complete:r}).promise()},saveTinyMCE(){"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave()},isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},compareTimesGreaterThan(e,t){e=e.replace(/(am|pm)/g," $1").toUpperCase(),t=t.replace(/(am|pm)/g," $1").toUpperCase();e=Date.parse("01 Jan 2021 "+e);return Date.parse("01 Jan 2021 "+t)<=e},isModernMarkupEnabled(){return!!wpforms_settings.isModernMarkupEnabled},initTokenUpdater(){d(".wpforms-form").on("focusin",function(e){var t=d(e.target.closest("form")),r=Date.now();this.needsTokenUpdate(r,t)&&this.updateToken(r,t,e)}.bind(this))},needsTokenUpdate(e,t){return e-1e3*(t.attr("data-token-time")||0)>=1e3*wpforms_settings.token_cache_lifetime&&!this.isUpdatingToken},updateToken(t,r,a){var e=r.data("formid");const i=r.find(".wpforms-submit");this.isUpdatingToken=!0,i.prop("disabled",!0),d.post(wpforms_settings.ajaxurl,{action:"wpforms_get_token",formId:e}).done(function(e){e.success?(r.attr("data-token-time",t),r.attr("data-token",e.data.token),i.prop("disabled",!1),a.target===i[0]&&i.trigger("click")):console.error("Failed to update token: ",e)}).fail(function(e,t,r){console.error("AJAX request failed: ",t,r)}).always(function(){this.isUpdatingToken=!1,i.prop("disabled",!1)}.bind(this))},restoreSubmitButtonOnEventPersisted(){p.onpageshow=function(e){e.persisted&&d(".wpforms-form").each(function(){var e=d(this);l.restoreSubmitButton(e,e.closest(".wpforms-container"))})}}};return l}(document,window,jQuery);wpforms.init();
Save Changes
Rename File
Rename