(()=>{"use strict";var e={1669:e=>{e.exports=jQuery}},t={};function a(e,t){if(!e)return;const a=e.jquery?e[0]:e;a&&"disabled"in a&&(a.disabled=t)}function n(e){const t=new URLSearchParams;return Object.keys(e).forEach((function(a){const n=e[a];null!=n&&t.append(a,String(n))})),t}var s=function a(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,a),i.exports}(1669);!function(e,t){t("body").on("click",".edd-extension-manager__actions .edd-extension-manager__action",(function(e){e.preventDefault();let s=t(this),i=s.attr("data-action"),d=s.attr("data-plugin"),o=s.attr("data-type"),r="",l="",c="",u=s.hasClass("edd-button__toggle"),p=s.attr("data-product");if(s.attr("disabled"))return;switch(i){case"activate":r="edd_activate_extension",l="edd-plugin__inactive",c="edd-plugin__active",u||s.text(EDDExtensionManager.activating);break;case"install":r="edd_install_extension",c="edd-plugin__active",s.text(EDDExtensionManager.installing);break;case"deactivate":r="edd_deactivate_extension",l="edd-plugin__active",c="edd-plugin__inactive",u||s.text(EDDExtensionManager.deactivating);break;default:return}s.hasClass("button-primary")&&s.removeClass("button-primary").addClass("updating-message");const g={action:r,nonce:EDDExtensionManager.extension_manager_nonce,plugin:d,type:o,pass:s.attr("data-pass"),id:s.attr("data-id"),product:p},_=s.closest(".edd-extension-manager__step"),m=s.closest(".edd-extension-manager__card"),v=!(t("#edd-admin-about").length||_.length||"activate"!==i&&"deactivate"!==i);!async function(e){const{url:t,data:s,$busy:i,applyOptimistic:d,revert:o,onResponse:r,debug:l}=e;a(i,!0);try{d&&d();const e=await fetch(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},credentials:"same-origin",body:n(s)});if(!e.ok)throw new Error("Network response was not ok");const a=await e.json();return l&&console.log(a),a&&a.success||o&&o(),r&&r(a),a}catch{o&&o()}finally{a(i,!1)}}({url:ajaxurl,data:g,$busy:s,applyOptimistic(){v&&m.removeClass(l).addClass(c)},revert:function(){v&&m.removeClass(c).addClass(l)},debug:EDDExtensionManager.debug,onResponse(e){if(t("#edd-admin-about").length){const t=s.closest(".actions");if(e.success)t.addClass("has-response").empty().append('<div class="status"><span class="status-label active">'+e.data.message+"</span></div>");else{let a=e.data.message;a||(a=EDDExtensionManager.plugin_install_failed),t.addClass("has-response").empty().append('<div class="status"><span class="status-label">'+a+"</span></div>")}}else{const t=s.closest(".edd-extension-manager__step");if(e.success)if(t.length){const a=t.next();a.length&&(t.fadeOut(),a.prepend('<div class="notice inline-notice notice-success"><p>'+e.data.message+"</p></div>"),a.fadeIn())}else s.closest(".edd-extension-manager__card").removeClass(l).addClass(c),e.data.button.length&&s.closest(".edd-extension-manager__control").empty().append(e.data.button);else{let a=e.data.message;if(a||(a="plugin"!==o?EDDExtensionManager.extension_install_failed:EDDExtensionManager.plugin_install_failed),t.length)t.fadeOut(),t.after('<div class="notice inline-notice notice-warning"><p>'+a+"</p></div>");else{const e=s.closest(".edd-extension-manager__actions");e.find(".notice").remove(),e.append('<div class="notice inline-notice notice-warning"><p>'+a+"</p></div>")}}}}})}));let s,i=t("#edd-extension-manager__bar-search");function d(){clearTimeout(s),s=setTimeout(o,342)}function o(){let e=i.val().toLowerCase(),a=0;if(e.length)t(".edd-extension-manager__card").each((function(){let n=t(this).text().toLowerCase().includes(e),s=t(this).data("filter")&&t(this).data("filter").toLowerCase().includes(e);n||s?(a++,t(this).removeClass("edd-hidden")):t(this).addClass("edd-hidden")}));else{let e=t(".edd-extension-manager__card");e.removeClass("edd-hidden"),a=e.length}t(".edd-extension-manager__card:not(.edd-hidden)").hide().show(0),t(".edd-extension-manager__results").remove(),t("#edd-extension-manager__bar-search").after('<div role="status" class="edd-extension-manager__results screen-reader-text">'+a+" "+EDDExtensionManager.results+"</div>")}i&&(EDDExtensionManager.filter&&(i.val(EDDExtensionManager.filter),d()),i.on("keyup",(function(e){d()})),i.on("search",(function(e){d()})))}(document,s)})();