"use strict";var WPMailSMTP=window.WPMailSMTP||{};WPMailSMTP.Admin=WPMailSMTP.Admin||{},WPMailSMTP.Admin.Settings=WPMailSMTP.Admin.Settings||function(i,e,a){var s={pluginSettingsChanged:!1,init:function(){a(i).ready(s.ready)},ready:function(){s.pageHolder=a(".wp-mail-smtp-tab-settings"),a("#screen-meta-links, #screen-meta").prependTo("#wp-mail-smtp-header-temp").show(),s.bindActions()},bindActions:function(){a(".wp-mail-smtp-mailer-image",s.pageHolder).click(function(){a(this).parents(".wp-mail-smtp-mailer").find("input").trigger("click")}),a(".wp-mail-smtp-mailer input",s.pageHolder).click(function(){var t=a(this);if(t.prop("disabled"))return t.hasClass("educate")&&s.education.upgradeMailer(t),!1;a(".wp-mail-smtp-mailer",s.pageHolder).removeClass("active"),a(this).parents(".wp-mail-smtp-mailer").addClass("active"),a(".wp-mail-smtp-mailer-option",s.pageHolder).addClass("hidden").removeClass("active"),a(".wp-mail-smtp-mailer-option-"+a(this).val(),s.pageHolder).addClass("active").removeClass("hidden")}),s.mailers.smtp.bindActions(),a("#wp-mail-smtp-pro-banner-dismiss",s.pageHolder).on("click",function(){a.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",task:"pro_banner_dismiss"}}).always(function(){a("#wp-mail-smtp-pro-banner",s.pageHolder).fadeOut("fast")})}),a(".js-wp-mail-smtp-mailer-notice-dismiss",s.pageHolder).on("click",function(t){t.preventDefault();var e=a(this),i=e.parents(".inline-notice");if(e.hasClass("disabled"))return!1;a.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",task:"notice_dismiss",notice:i.data("notice"),mailer:i.data("mailer")},beforeSend:function(){e.addClass("disabled")}}).always(function(){i.fadeOut("fast",function(){e.removeClass("disabled")})})}),a("#wp-mail-smtp-debug .error-log-toggle").on("click",function(t){t.preventDefault(),a("#wp-mail-smtp-debug .error-log-toggle").find(".dashicons").toggleClass("dashicons-arrow-right-alt2 dashicons-arrow-down-alt2"),a("#wp-mail-smtp-debug .error-log").slideToggle(),a("#wp-mail-smtp-debug .error-log-note").toggle()}),a(".js-wp-mail-smtp-provider-remove",s.pageHolder).on("click",function(){return confirm(wp_mail_smtp.text_provider_remove)}),a(".wp-mail-smtp-setting-copy",s.pageHolder).click(function(t){t.preventDefault(),a("#"+a(this).data("source_id")).get(0).select(),i.execCommand("Copy");var e=a(this).find(".dashicons");e.removeClass("dashicons-admin-page").addClass("dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate"),setTimeout(function(){e.removeClass("dashicons-yes-alt wp-mail-smtp-success wp-mail-smtp-animate").addClass("dashicons-admin-page")},1e3)}),a("#wp-mail-smtp-notice-bar").on("click",".dismiss",function(){var t=a(this).closest("#wp-mail-smtp-notice-bar");t.addClass("out"),setTimeout(function(){t.remove()},300),a.post(ajaxurl,{action:"wp_mail_smtp_notice_bar_dismiss",nonce:wp_mail_smtp.nonce})}),s.triggerExitNotice(),s.beforeSaveChecks(),a(".js-wp-mail-smtp-setting-mailer-radio-input",s.pageHolder).on("change",this.processMailerSettingsOnChange)},education:{upgradeMailer:function(t){a.alert({backgroundDismiss:!0,escapeKey:!0,animationBounce:1,theme:"modern",type:"blue",animateFromElement:!1,draggable:!1,closeIcon:!0,useBootstrap:!1,title:wp_mail_smtp.education.upgrade_title.replace(/%name%/g,t.siblings("label").text().trim()),icon:'">'+wp_mail_smtp.education.upgrade_icon_lock+''+wp_mail_smtp.education.upgrade_bonus+wp_mail_smtp.education.upgrade_doc+"")},buttons:{confirm:{text:wp_mail_smtp.education.upgrade_button,btnClass:"btn-confirm",keys:["enter"],action:function(){e.open(wp_mail_smtp.education.upgrade_url+"&utm_content="+encodeURI(t.val()),"_blank")}}}})}},mailers:{smtp:{bindActions:function(){a("#wp-mail-smtp-setting-smtp-auth").change(function(){a("#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass").toggleClass("inactive")}),a("#wp-mail-smtp-setting-row-smtp-encryption input").change(function(){var t=a(this),e=a("#wp-mail-smtp-setting-smtp-port",s.pageHolder);"tls"===t.val()?(e.val("587"),a("#wp-mail-smtp-setting-row-smtp-autotls").addClass("inactive")):("ssl"===t.val()?e.val("465"):e.val("25"),a("#wp-mail-smtp-setting-row-smtp-autotls").removeClass("inactive"))})}}},triggerExitNotice:function(){var t=a(".wp-mail-smtp-page-general:not( .wp-mail-smtp-tab-test )");a(e).on("beforeunload",function(){if(s.pluginSettingsChanged)return wp_mail_smtp.text_settings_not_saved}),a(":input:not( #wp-mail-smtp-setting-license-key, .wp-mail-smtp-not-form-input )",t).on("change",function(){s.pluginSettingsChanged=!0}),a("form",t).on("submit",function(){s.pluginSettingsChanged=!1})},beforeSaveChecks:function(){a("form",s.pageHolder).on("submit",function(){if("mail"===a(".wp-mail-smtp-mailer input:checked",s.pageHolder).val()){var t=a(this);return a.alert({backgroundDismiss:!1,escapeKey:!1,animationBounce:1,theme:"modern",type:"orange",animateFromElement:!1,draggable:!1,closeIcon:!1,useBootstrap:!1,icon:'">