!function(d){"use strict";var l,f={settings:{iconActivate:'',iconDeactivate:'',iconInstall:'',iconSpinner:'',mediaFrame:!1},init:function(){l=this.settings,d(f.ready),f.initEntriesSingle(),f.initEntriesList(),f.initWelcome(),d(document).on("wpformsReady",f.initAddons),f.initSettings(),f.initTools(),f.initUpgrades()},ready:function(){d(".notice").show(),d("#screen-meta-links, #screen-meta").prependTo("#wpforms-header-temp").show(),f.initChoicesJS(),f.initCheckboxMultiselectColumns(),d(".wpforms-color-picker").each(function(){var e=d(this);e.minicolors({defaultValue:e.data("fallback-color")||""})}),d(".wpforms-file-upload").each(function(){var e=d(this).find("input[type=file]"),n=d(this).find("label"),o=n.html();e.on("change",function(e){var t="";this.files&&1'+t+"")):(e.parent().removeClass("checked"),n.find("#"+o).remove())}),d(document).on("click",".checkbox-multiselect-columns .all",function(e){e.preventDefault(),d(this).closest(".checkbox-multiselect-columns").find("input[type=checkbox]").prop("checked",!0).trigger("change"),d(this).remove()})},initFormOverview:function(){console.warn('WARNING! Function "WPFormsAdmin.initFormOverview()" has been deprecated, please use the new "WPFormsForms.Overview.init()" function instead!'),window.WPFormsForms.Overview.init()},initEntriesList:function(){d(document).on("click","#wpforms-entries-table-edit-columns",function(e){e.preventDefault(),f.entriesListFieldColumn()}),d(document).on("click","#wpforms-entries-list .form-selector .toggle",function(e){e.preventDefault(),d(this).toggleClass("active").next(".form-list").toggle()}),d(document).on("click","#wpforms-entries-table #doaction",function(e){var t=d(this).closest("form"),n=t.find("table"),o=t.find("select[name=action]"),n=n.find("input[name^=entry_id]:checked");"delete"!==o.val()&&"trash"!==o.val()||!n.length||(o="delete"===o.val()?wpforms_admin.entry_delete_n_confirm:wpforms_admin.entry_trash_n_confirm,e.preventDefault(),d.confirm({title:wpforms_admin.heads_up,content:o.replace("{entry_count}",n.length),icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){t.trigger("submit")}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}}))}),d(document).on("click","#wpforms-entries-list .wp-list-table .delete",function(e){e.preventDefault();var t=d(this).attr("href");d.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.entry_delete_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),d(document).on("click","#wpforms-entries-list .wp-list-table .trash",function(e){e.preventDefault();const t=d(this).attr("href");d.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.entry_trash_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:()=>{window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),d(document).on("click","#wpforms-entries-list .wp-list-table .indicator-star",function(e){e.preventDefault();var e=d(this),t=d("#wpforms-entries-list .starred-num"),n=e.parents("table");let o="",i=Number(t.text());e.hasClass("star")?(o="star",i++,e.attr("title",wpforms_admin.entry_unstar)):(o="unstar",i--,e.attr("title",wpforms_admin.entry_star)),e.toggleClass("star unstar"),n.hasClass("wpforms-entries-table-spam")||n.hasClass("wpforms-entries-table-trash")||t.text(i);n={task:o,action:"wpforms_entry_list_star",nonce:wpforms_admin.nonce,entryId:e.data("id"),formId:e.data("form-id")};d.post(wpforms_admin.ajax_url,n)}),d(document).on("click","#wpforms-entries-list .wp-list-table .indicator-read",function(e){e.preventDefault();var e=d(this),t=d("#wpforms-entries-list .unread-num"),n=e.parents("table");let o="",i=Number(t.text());e.hasClass("read")?(o="read",i--,e.attr("title",wpforms_admin.entry_unread)):(o="unread",i++,e.attr("title",wpforms_admin.entry_read)),e.toggleClass("read unread"),n.hasClass("wpforms-entries-table-spam")||n.hasClass("wpforms-entries-table-trash")||t.text(i);n={task:o,action:"wpforms_entry_list_read",nonce:wpforms_admin.nonce,entryId:e.data("id"),formId:e.data("form-id")};d.post(wpforms_admin.ajax_url,n)}),d(document).on("click","#wpforms-entries-list .form-details-actions-removeall",function(e){e.preventDefault();const t=d(this).data("page"),n=f.getDeleteAllNoticeData(t),o=d(this).attr("href"),i=d("#wpforms-entries-table"),s=i.data("filtered-count")?parseInt(i.data("filtered-count"),10):0,a={action:"wpforms_entry_list_process_"+n.action+"_all",form_id:i.find('input[name="form_id"]').val(),date:i.find('input[name="date"]').val(),page:t,search:{field:i.find('select[name="search[field]"]').val(),comparison:i.find('select[name="search[comparison]"]').val(),term:i.find('input[name="search[term]"]').val()},nonce:wpforms_admin.nonce,url:o};d.confirm({title:wpforms_admin.heads_up,content:s&&d("#wpforms-reset-filter").length?n.content.replace("{entry_count}",s):n.contentAll,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:()=>{d.get(wpforms_admin.ajax_url,a).done(function(e){e.success&&(window.location=_.isEmpty(e.data)?o:e.data)})}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),d(document).on("heartbeat-send",function(e,t){var n,o=d("#wpforms-entries-list");o.length&&!o.find(".wpforms-dash-widget").length&&void 0!==(n=o.find("#wpforms-entries-table").data("last-entry-id"))&&(t.wpforms_new_entries_entry_id=n,t.wpforms_new_entries_form_id=o.find("input[name=form_id]").val())}),d(document).on("heartbeat-tick",function(e,t){var n,o,i=d("#wpforms-entries-list");i.length&&t.wpforms_new_entries_notification&&(n=i.find(".wp-list-table thead tr").first().children().length,i.find(".new-entries-notification").length||i.find(".wp-list-table thead").append(''),(o=i.find(".new-entries-notification a")).text(t.wpforms_new_entries_notification).slideDown({start:function(){o.css("display","block")},always:function(){o.css("display","block")}}))})},initEntriesSingle:function(){"wpforms-entries"===f.getQueryString("page")&&"details"===f.getQueryString("view")&&f.entryHotkeys(),d(document).on("click","#wpforms-entries-single .wpforms-entry-delete a",function(e){e.preventDefault();const t=d(this).attr("href");d.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.entry_delete_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),d(document).on("click","#wpforms-entries-single .trash",function(e){e.preventDefault();const t=d(this).attr("href");d.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.entry_trash_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:()=>{window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),d(document).on("click","#wpforms-entries-single .wpforms-entry-print a",function(e){e.preventDefault(),window.open(d(this).attr("href"))}),d(document).on("click","#wpforms-entries-single .wpforms-empty-field-toggle",function(e){e.preventDefault(),"true"===wpCookies.get("wpforms_entry_hide_empty")?(wpCookies.remove("wpforms_entry_hide_empty"),d(this).text(wpforms_admin.entry_empty_fields_hide)):(wpCookies.set("wpforms_entry_hide_empty","true",2592e3),d(this).text(wpforms_admin.entry_empty_fields_show)),d(".wpforms-entry-field.empty, .wpforms-edit-entry-field.empty").toggle()}),d(document).on("click","#wpforms-entries-single .wpforms-entry-notes-new .add",function(e){e.preventDefault(),d(this).hide().next("form").stop().slideToggle()}),d(document).on("click","#wpforms-entries-single .wpforms-entry-notes-new .cancel",function(e){e.preventDefault(),d(this).closest("form").stop().slideToggle(),d(".wpforms-entry-notes-new .add").show()}),d(document).on("click","#wpforms-entries-single .wpforms-entry-notes-byline .note-delete",function(e){e.preventDefault();var t=d(this).attr("href");d.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.entry_note_delete_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})})},entryHotkeys:function(){d(document).on("keydown",function(e){74!==e.keyCode||e.metaKey||f.isFormTypeNode(e.target.nodeName)?75!==e.keyCode||e.metaKey||f.isFormTypeNode(e.target.nodeName)||"#"!==(e=d("#wpforms-admin-single-navigation-next-link").attr("href"))&&(window.location.href=e):"#"!==(e=d("#wpforms-admin-single-navigation-prev-link").attr("href"))&&(window.location.href=e)})},entriesListFieldColumn:function(){d.alert({title:wpforms_admin.entry_field_columns,boxWidth:"500px",content:l.iconSpinner+d("#wpforms-field-column-select").html(),onContentReady:function(){var e=this.$content,t=e.find("select"),n=new Choices(t[0],{shouldSort:!1,removeItemButton:!0,loadingText:wpforms_admin.choicesjs_loading,noResultsText:wpforms_admin.choicesjs_no_results,noChoicesText:wpforms_admin.choicesjs_no_choices,itemSelectText:"",fuseOptions:window.wpforms_admin_choicesjs_config.fuseOptions,callbackOnInit:function(){e.find(".fa").remove(),e.find("form").show()}});d(".jconfirm-content-pane, .jconfirm-box").css("overflow","visible"),n.passedElement.element.addEventListener("change",function(){n.hideDropdown(!0)},!1)},buttons:{confirm:{text:wpforms_admin.save_refresh,btnClass:"btn-confirm",keys:["enter"],action:function(){this.$content.find("form").trigger("submit")}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})},initWelcome:function(){d(document).on("click","#wpforms-welcome .play-video",function(e){e.preventDefault();d.dialog({title:!1,content:'
',closeIcon:!0,boxWidth:"70%"})})},initAddons:function(){var e;d("#wpforms-admin-addons").length&&(d("#wpforms-admin-addons-list").length&&(e=new List("wpforms-admin-addons-list",{valueNames:["addon-link"]}),d("#wpforms-admin-addons-search").on("keyup search",function(){f.updateAddonSearchResult(this,e)})),d(document).on("click","#wpforms-admin-addons .addon-item button",function(e){if(e.preventDefault(),d(this).hasClass("disabled"))return!1;f.addonToggle(d(this))}))},updateAddonSearchResult:function(e,t){var e=d(e).val(),n=d("#addons-heading");e?n.text(wpforms_admin.addon_search):n.text(n.data("text")),e=e.replace(/[.,]/g," "),t.search(e)},setAddonState:function(e,t,n,o){var t={activate:"wpforms_activate_addon",install:"wpforms_install_addon",deactivate:"wpforms_deactivate_addon"}[t];t&&(t={action:t,nonce:wpforms_admin.nonce,plugin:e,type:n},d.post(wpforms_admin.ajax_url,t,function(e){o(e)}).fail(function(e){console.log(e.responseText)}))},addonToggle:function(t){var n,o,i,s,a,r,c=t.closest(".addon-item"),e=t.attr("data-plugin"),m=t.attr("data-type");if(t.hasClass("status-go-to-url"))window.open(t.attr("data-plugin"),"_blank");else{if(t.prop("disabled",!0).addClass("loading"),t.html(l.iconSpinner),t.hasClass("status-active"))n="deactivate",o="status-installed","plugin"===m&&(o+=" button button-secondary"),i=wpforms_admin.addon_inactive,s=wpforms_admin.addon_activate,a=wpforms_admin.addon_deactivate,"addon"===m&&(s=l.iconActivate+s,a=l.iconDeactivate+a);else if(t.hasClass("status-installed"))n="activate",o="status-active","plugin"===m&&(o+=" button button-secondary disabled"),i=wpforms_admin.addon_active,s=wpforms_admin.addon_deactivate,"addon"===m?(s=l.iconDeactivate+s,a=l.iconActivate+wpforms_admin.addon_activate):"plugin"===m&&(s=wpforms_admin.addon_activated,a=wpforms_admin.addon_activate);else{if(!t.hasClass("status-missing"))return;n="install",o="status-active","plugin"===m&&(o+=" button disabled"),i=wpforms_admin.addon_active,s=wpforms_admin.addon_activated,a=l.iconInstall,"addon"===m&&(s=l.iconActivate+wpforms_admin.addon_deactivate,a+=wpforms_admin.addon_install)}f.setAddonState(e,n,m,function(e){e.success?("install"===n?(t.attr("data-plugin",e.data.basename),r=e.data.msg,e.data.is_activated||(i=wpforms_admin.addon_inactive,s="plugin"===m?wpforms_admin.addon_activate:l.iconActivate+wpforms_admin.addon_activate,o="plugin"===m?"status-installed button button-secondary":"status-installed")):r=e.data,c.find(".actions").append('
'+r+"
"),c.find("span.status-label").removeClass("status-active status-installed status-missing").addClass(o).removeClass("button button-primary button-secondary disabled").text(i),t.removeClass("status-active status-installed status-missing").removeClass("button button-primary button-secondary disabled").addClass(o).html(s)):("object"==typeof e.data?"addon"===m?c.find(".actions").append('

'+wpforms_admin.addon_error+"

"):c.find(".actions").append('

'+wpforms_admin.plugin_error+"

"):c.find(".actions").append('

'+e.data+"

"),"install"===n&&"plugin"===m&&t.addClass("status-go-to-url").removeClass("status-missing"),t.html(a)),t.prop("disabled",!1).removeClass("loading"),c.find(".actions").find(".msg.error").length||setTimeout(function(){d(".addon-item .msg").remove()},3e3)})}},initSettings:function(){d(document).on("wpformsReady",function(){var e,t;d("#wpforms-settings").length&&(e=f.getQueryString("wpforms-integration"),t=f.getQueryString("jump"),e?d("body").animate({scrollTop:d("#wpforms-integration-"+e).offset().top},1e3):t&&d("body").animate({scrollTop:d("#"+t).offset().top},1e3),d(".wpforms-admin-settings-form").conditions([{conditions:{element:"#wpforms-setting-gdpr",type:"checked",operator:"is"},actions:{if:{element:"#wpforms-setting-row-gdpr-disable-uuid,#wpforms-setting-row-gdpr-disable-details",action:"show"},else:{element:"#wpforms-setting-row-gdpr-disable-uuid,#wpforms-setting-row-gdpr-disable-details",action:"hide"}},effect:"appear"},{conditions:{element:"input[name=captcha-provider]:checked",type:"value",operator:"=",condition:"hcaptcha"},actions:{if:[{element:".wpforms-setting-row",action:"show"},{element:".wpforms-setting-recaptcha, #wpforms-setting-row-recaptcha-site-key, #wpforms-setting-row-recaptcha-secret-key, #wpforms-setting-row-recaptcha-fail-msg, .wpforms-setting-turnstile, #wpforms-setting-row-turnstile-heading, #wpforms-setting-row-turnstile-site-key, #wpforms-setting-row-turnstile-secret-key, #wpforms-setting-row-turnstile-theme, #wpforms-setting-row-turnstile-fail-msg",action:"hide"}]},effect:"appear"},{conditions:{element:"input[name=captcha-provider]:checked",type:"value",operator:"=",condition:"recaptcha"},actions:{if:[{element:".wpforms-setting-row",action:"show"},{element:"#wpforms-setting-row-hcaptcha-heading, #wpforms-setting-row-hcaptcha-site-key, #wpforms-setting-row-hcaptcha-secret-key, #wpforms-setting-row-hcaptcha-fail-msg, #wpforms-setting-row-turnstile-heading, #wpforms-setting-row-turnstile-site-key, #wpforms-setting-row-turnstile-secret-key, #wpforms-setting-row-turnstile-theme, #wpforms-setting-row-turnstile-fail-msg",action:"hide"}]},effect:"appear"},{conditions:{element:"input[name=captcha-provider]:checked",type:"value",operator:"=",condition:"turnstile"},actions:{if:[{element:".wpforms-setting-row",action:"show"},{element:"#wpforms-setting-row-hcaptcha-heading, #wpforms-setting-row-hcaptcha-site-key, #wpforms-setting-row-hcaptcha-secret-key, #wpforms-setting-row-hcaptcha-fail-msg, .wpforms-setting-recaptcha, #wpforms-setting-row-recaptcha-site-key, #wpforms-setting-row-recaptcha-secret-key, #wpforms-setting-row-recaptcha-fail-msg",action:"hide"}]},effect:"appear"},{conditions:{element:"input[name=captcha-provider]:checked",type:"value",operator:"=",condition:"none"},actions:{if:[{element:".wpforms-setting-row",action:"hide"},{element:".wpforms-setting-captcha-heading, #wpforms-setting-row-captcha-provider",action:"show"}]},effect:"appear"}]))}),d(document).on("change","#wpforms-setting-row-render-engine input",f.settingsRenderEngineChange),d(document).on("change","#wpforms-setting-disable-css",function(){f.settingsFormStylesAlert(d(this).val())}),d(document).on("click",".wpforms-setting-row-image button",function(e){e.preventDefault(),d(this).hasClass("wpforms-setting-remove-image")?d(this).closest(".wpforms-setting-row-image").find("input").val("").attr("value","").end().find("img").remove():f.imageUploadModal(d(this))}),d(document).on("click","#wpforms-setting-license-key-verify",function(e){e.preventDefault(),f.licenseVerify(d(this))}),d(document).on("click",".wpforms-setting-license-wrapper",function(e){e.preventDefault();e=d("#wpforms-setting-license-key");e.length&&e.prop("disabled")&&f.licenseEditMessage()}),d(document).on("click","#wpforms-setting-license-key-deactivate",function(e){e.preventDefault(),f.licenseDeactivate(d(this))}),d(document).on("click","#wpforms-setting-license-key-refresh",function(e){e.preventDefault(),f.licenseRefresh(d(this))}),d(document).on("click",".wpforms-settings-provider-connect",function(e){e.preventDefault();e=d(this);f.integrationConnect(e)}),d(document).on("click",".wpforms-settings-provider-accounts-list .remove a",function(e){e.preventDefault(),f.integrationDisconnect(d(this))}),d(document).on("click",".wpforms-settings-provider:not(.focus-out) .wpforms-settings-provider-header",function(e){e.preventDefault();var t=d(this);t.parent().find(".wpforms-settings-provider-accounts").stop(!1,!0).slideToggle("",function(){t.parent().find(".wpforms-settings-provider-logo i").toggleClass("fa-chevron-right fa-chevron-down")})}),d(document).on("click",".wpforms-settings-provider-accounts-toggle a",function(e){e.preventDefault();e=d(this).parent().next(".wpforms-settings-provider-accounts-connect");e.find("input[type=text], input[type=password]").val(""),e.stop().slideToggle()}),d(document).on("change","#wpforms-setting-row-captcha-provider input",function(){var e=d("#wpforms-setting-row-captcha-preview");"hcaptcha"===this.value||"turnstile"===this.value?e.removeClass("wpforms-hidden"):"none"===this.value?e.addClass("wpforms-hidden"):d("#wpforms-setting-row-recaptcha-type input:checked").trigger("change"),e.find(".wpforms-captcha-preview").length&&(e.find(".wpforms-captcha-preview").empty(),e.find(".wpforms-captcha-placeholder").removeClass("wpforms-hidden"))}),d(document).on("change","#wpforms-setting-row-recaptcha-type input",function(){d("#wpforms-setting-row-captcha-preview").toggleClass("wpforms-hidden","v2"!==this.value),d("#wpforms-setting-row-recaptcha-v3-threshold").toggleClass("wpforms-hidden","v3"!==this.value)}),d(document).on("change",".wpforms-toggle-control input",function(){var e=d(this),t=e.is(":checked"),n=t?"on":"off",o=e.closest(".wpforms-setting-field"),e=e.closest(".wpforms-toggle-control").find(".wpforms-toggle-control-status"),i=o.find(".wpforms-toggle-desc.desc-on"),o=o.find(".wpforms-toggle-desc.desc-off"),s=0')})),l.media_frame.open()},licenseVerify:function(i){var s=i.closest(".wpforms-setting-row"),a=d("#wpforms-setting-license-key"),e=i.outerWidth(),r=i.text(),t={action:"wpforms_verify_license",nonce:wpforms_admin.nonce,license:a.val()};i.html(l.iconSpinner).css("width",e).prop("disabled",!0),d.post(wpforms_admin.ajax_url,t,function(e){var t,n="fa fa-check-circle",o="green";e.success?(t=e.data.msg,i.hide(),s.find("#wpforms-setting-license-key-info-message").empty().hide(),s.find(".type, .desc, #wpforms-setting-license-key-deactivate").show(),s.find(".type strong").text(e.data.type),d(".wpforms-license-notice").remove(),a.prop("disabled",!0).addClass("wpforms-setting-license-is-valid").attr("value",a.val())):(n="fa fa-exclamation-circle",o="orange",t=e.data,s.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide(),a.prop("disabled",!1)),d.alert({title:!1,content:t,icon:n,type:o,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}}),i.html(r).css("width","auto").prop("disabled",!1)}).fail(function(e){a.prop("disabled",!1),console.log(e.responseText)})},licenseEditMessage:function(){d.alert({title:wpforms_admin.heads_up,content:wpforms_admin.edit_license,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})},licenseDeactivate:function(e){const a=d(e),r=a.closest(".wpforms-setting-row");e=a.outerWidth();const c=a.text();var t={action:"wpforms_deactivate_license",nonce:wpforms_admin.nonce};a.html(l.iconSpinner).css("width",e).prop("disabled",!0),d.post(wpforms_admin.ajax_url,t,function(e){let t="fa fa-info-circle",n="blue",o=wpforms_admin.success;var i=e.data,s=i.msg&&"string"==typeof i.msg?i.msg:wpforms_admin.something_went_wrong;e.success?(r.find("#wpforms-setting-license-key").val("").attr("value","").prop({readonly:!1,disabled:!1}).removeClass(),r.find(".wpforms-license-key-deactivate-remove").remove(),r.find("#wpforms-setting-license-key-info-message").html(i.info).show(),r.find("#wpforms-setting-license-key-verify").prop("disabled",!1).show(),r.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide()):(t="fa fa-exclamation-circle",n="orange",o=wpforms_admin.oops),d.alert({title:o,content:s,icon:t,type:n,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}}),a.html(c).css("width","auto").prop("disabled",!1)}).fail(function(e){console.log(e.responseText)})},licenseRefresh:function(e){var i=d(e).closest(".wpforms-setting-row"),s=d("#wpforms-setting-license-key"),e={action:"wpforms_refresh_license",nonce:wpforms_admin.nonce,license:s.val()};d.post(wpforms_admin.ajax_url,e,function(e){var t,n="fa fa-check-circle",o="green";e.success?(t=e.data.msg,i.find(".type strong").text(e.data.type)):(n="fa fa-exclamation-circle",o="orange",t=e.data,i.find(".type, .desc").hide(),s.removeClass("wpforms-setting-license-is-valid").addClass("wpforms-setting-license-is-invalid")),d.alert({title:!1,content:t,icon:n,type:o,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}).fail(function(e){console.log(e.responseText)})},integrationConnect:function(t){var e=t.outerWidth(),n=t.text(),o=t.closest(".wpforms-settings-provider"),i={action:"wpforms_settings_provider_add_"+t.data("provider"),data:t.closest("form").serialize(),provider:t.data("provider"),nonce:wpforms_admin.nonce},s=wpforms_admin.provider_auth_error;t.html(wpforms_admin.connecting).css("width",e).prop("disabled",!0),d.post(wpforms_admin.ajax_url,i,function(e){e.success?(o.find(".wpforms-settings-provider-accounts-list ul").append(e.data.html),o.addClass("connected"),t.closest(".wpforms-settings-provider-accounts-connect").stop().slideToggle()):(Object.prototype.hasOwnProperty.call(e,"data")&&Object.prototype.hasOwnProperty.call(e.data,"error_msg")&&(s+="
"+e.data.error_msg),f.integrationError(s))}).fail(function(){f.integrationError(s)}).always(function(){t.html(n).css("width","auto").prop("disabled",!1)})},integrationDisconnect:function(e){var n=d(e),o=n.parents(".wpforms-settings-provider"),t={action:"wpforms_settings_provider_disconnect_"+n.data("provider"),provider:n.data("provider"),key:n.data("key"),nonce:wpforms_admin.nonce},i=wpforms_admin.provider_delete_error;d.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.provider_delete_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){d.post(wpforms_admin.ajax_url,t,function(e){var t;e.success?(n.parent().parent().remove(),void 0!==(t=o.find(".wpforms-settings-provider-accounts-list li").length)&&0!==t||o.removeClass("connected"),d(document).trigger("wpformsProviderRemoved",[o,e])):(Object.prototype.hasOwnProperty.call(e,"data")&&Object.prototype.hasOwnProperty.call(e.data,"error_msg")&&(i+="
"+e.data.error_msg),f.integrationError(i))}).fail(function(){f.integrationError(i)})}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})},integrationError:function(e){d.alert({title:wpforms_admin.something_went_wrong,content:e,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})},initTools(){d(document).on("change","#wpforms-tools-form-import, #wpforms-tools-form-other-import, #wpforms-tools-form-export, #wpforms-tools-form-template",function(){var e=d(this);e.parents("form").find("button").attr("aria-disabled",0===e.val().length)}),d(document).on("click","#wpforms-system-information-copy",function(e){e.preventDefault(),f.copySystemInformation()}),d(document).on("click","#wpforms-ssl-verify",function(e){e.preventDefault(),f.verifySSLConnection()}),d(document).on("click","#wpforms-importer-forms-submit",function(e){if(e.preventDefault(),d("#wpforms-importer-forms input:checked").length){const t=[];d("#wpforms-importer-forms input:checked").each(function(e){t[e]=d(this).val()}),wpforms_admin.isPro?f.importForms(t):f.analyzeForms(t)}else d.alert({title:wpforms_admin.heads_up,content:wpforms_admin.importer_forms_required,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}),d(document).on("click","#wpforms-importer-continue-submit",function(e){e.preventDefault(),f.importForms(l.formIDs)})},copySystemInformation(){d("#wpforms-system-information").select(),document.execCommand("copy")},verifySSLConnection(){const t=d("#wpforms-ssl-verify"),n=t.text(),o=t.outerWidth(),i=t.parent();t.css("width",o).prop("disabled",!0).text(wpforms_admin.testing);var e={action:"wpforms_verify_ssl",nonce:wpforms_admin.nonce};d.post(wpforms_admin.ajax_url,e,function(e){f.debug(e),i.find(".wpforms-notice").remove(),e.success&&t.before('
'+e.data.msg+"
"),!e.success&&e.data.msg&&t.before('
'+e.data.msg+"
"),!e.success&&e.data.debug&&t.before('
'+e.data.debug+"
"),t.css("width",o).prop("disabled",!1).text(n)})},analyzeForms:function(e){var t=d("#wpforms-importer-analyze");t.find(".form-total").text(e.length),t.find(".form-current").text("1"),d("#wpforms-importer-forms").hide(),t.show(),l.analyzeQueue=e,l.analyzed=0,l.analyzeUpgrade=[],l.formIDs=e,f.analyzeForm()},analyzeForm:function(){var t=d("#wpforms-importer-analyze"),n=_.first(l.analyzeQueue),e={action:"wpforms_import_form_"+f.getQueryString("provider"),analyze:1,form_id:n,nonce:wpforms_admin.nonce};d.post(wpforms_admin.ajax_url,e,function(e){e.success&&(_.isEmpty(e.data.upgrade_plain)&&_.isEmpty(e.data.upgrade_omit)||l.analyzeUpgrade.push({name:e.data.name,fields:_.union(e.data.upgrade_omit,e.data.upgrade_plain)}),l.analyzeQueue=_.without(l.analyzeQueue,n),l.analyzed++,_.isEmpty(l.analyzeQueue)?_.isEmpty(l.analyzeUpgrade)?f.importForms(l.formIDs):(e=wp.template("wpforms-importer-upgrade"),t.find(".upgrade").append(e(l.analyzeUpgrade)),t.find(".upgrade").show(),t.find(".process-analyze").hide()):(t.find(".form-current").text(l.analyzed+1),f.analyzeForm()))})},importForms:function(e){var t=d("#wpforms-importer-process");t.find(".form-total").text(e.length),t.find(".form-current").text("1"),d("#wpforms-importer-forms, #wpforms-importer-analyze").hide(),t.show(),l.importQueue=e,l.imported=0,f.importForm()},importForm:function(){var n=d("#wpforms-importer-process"),o=_.first(l.importQueue),e={action:"wpforms_import_form_"+f.getQueryString("provider"),form_id:o,nonce:wpforms_admin.nonce};d.post(wpforms_admin.ajax_url,e,function(e){var t;e.success&&(t=e.data.error?wp.template("wpforms-importer-status-error"):wp.template("wpforms-importer-status-update"),n.find(".status").prepend(t(e.data)),n.find(".status").show(),l.importQueue=_.without(l.importQueue,o),l.imported++,_.isEmpty(l.importQueue)?(n.find(".process-count").hide(),n.find(".forms-completed").text(l.imported),n.find(".process-completed").show()):(n.find(".form-current").text(l.imported+1),f.importForm()))})},initUpgrades:function(){d(document).on("click","#wpforms-upgrade-143 button",function(e){e.preventDefault();var t=d(this),e=t.outerWidth(),n=d("#wpforms-upgrade-143 .status"),o={action:"wpforms_upgrade_143",nonce:wpforms_admin.nonce,init:!0,incomplete:t.data("incomplete")};t.html(l.iconSpinner).css("width",e).prop("disabled",!0),d.post(wpforms_admin.ajax_url,o,function(e){e.success&&(l.upgraded=Number(e.data.upgraded),l.upgradeTotal=Number(e.data.total),e=Math.round(Number(l.upgraded)/Number(l.upgradeTotal)*100),t.remove(),n.find(".bar").css("width",e+"%"),n.show().find(".total").text(l.upgradeTotal),n.find(".current").text(l.upgraded),n.find(".percent").text(e+"%"),f.upgrade143())})})},upgrade143:function(){var n=d("#wpforms-upgrade-143 .status"),e={action:"wpforms_upgrade_143",nonce:wpforms_admin.nonce,upgraded:l.upgraded};d.post(wpforms_admin.ajax_url,e,function(e){var t;e.success&&(l.upgraded=Number(l.upgraded)+Number(e.data.count),t=Math.round(Number(l.upgraded)/Number(l.upgradeTotal)*100),n.find(".bar").css("width",t+"%"),Number(e.data.count)<10?(n.find(".progress-bar").addClass("complete"),n.find(".msg").text(wpforms_admin.upgrade_completed)):(n.find(".current").text(l.upgraded),n.find(".percent").text(t+"%"),f.upgrade143()))})},initFlyoutMenu:function(){var e,t,n,a,r,c=d("#wpforms-flyout");0!==c.length&&(e=c.find(".wpforms-flyout-head"),t=e.find("img"),n={state:"inactive",srcInactive:t.attr("src"),srcActive:t.data("active")},e.on("click",function(e){e.preventDefault(),"active"===n.state?(c.removeClass("opened"),t.attr("src",n.srcInactive),n.state="inactive"):(c.addClass("opened"),t.attr("src",n.srcActive),n.state="active")}),0!==(a=d("#wpfooter")).length)&&(r=d("#wpforms-overview, #wpforms-entries-list, #wpforms-tools.wpforms-tools-tab-action-scheduler, #wpforms-tools.wpforms-tools-tab-logs"),d(window).on("resize scroll",_.debounce(function(e){var t=a.offset().top,n=t+a.height(),o=0"trash"===e?{contentAll:wpforms_admin.entry_delete_all_confirm,content:wpforms_admin.entry_delete_n_confirm,action:"delete"}:{contentAll:wpforms_admin.entry_trash_all_confirm,content:wpforms_admin.entry_trash_n_confirm,action:"trash"}};f.init(),window.WPFormsAdmin=f}(jQuery);