(()=>{var e={1669:e=>{"use strict";e.exports=jQuery}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}var n=o(1669),r=o(1669);const s={init:function(){this.revoke_api_key(),this.regenerate_api_key(),this.create_api_key(),this.recount_stats()},revoke_api_key:function(){n(document.body).on("click",".edd-revoke-api-key",(function(e){return confirm(edd_vars.revoke_api_key)}))},regenerate_api_key:function(){n(document.body).on("click",".edd-regenerate-api-key",(function(e){return confirm(edd_vars.regenerate_api_key)}))},create_api_key:function(){n(document.body).on("submit","#api-key-generate-form",(function(e){const t=n('input[type="text"][name="user_id"]');t.css("border-color","#ddd");const o=t.val();if(o.length<1||0===o)return t.css("border-color","#ff0000"),!1}))},recount_stats:function(){n(document.body).on("change","#recount-stats-type",(function(){const e=n("#edd-tools-recount-form"),t=n("option:selected",this).data("type"),o=n("#recount-stats-submit"),r=n("#tools-product-dropdown");e.find(".notice-wrap").remove(),o.attr("disabled",!1).removeClass("updated-message"),r.hide(),n(".edd-recount-stats-descriptions span").hide(),"recount-download"===t?(r.show(),r.find(".edd-select-chosen").css("width","auto")):"reset-stats"===t?(e.append('<div class="notice-wrap"></div>'),e.find(".notice-wrap").html('<div class="notice notice-warning"><p><input type="checkbox" id="confirm-reset" name="confirm_reset_store" value="1" /> <label for="confirm-reset">'+edd_vars.reset_stats_warn+"</label></p></div>"),n("#recount-stats-submit").attr("disabled",!0)):(r.hide(),r.val(0)),n("#"+t).show()})),n(document.body).on("change","#confirm-reset",(function(){n(this).is(":checked")?n("#recount-stats-submit").attr("disabled",!1):n("#recount-stats-submit").attr("disabled",!0)})),n("#edd-tools-recount-form").submit((function(e){e.preventDefault();const t=n("#recount-stats-type").val(),o=n(this),r=n("option:selected",this).data("type");if("reset-stats"===r){if(n("#confirm-reset").is(":checked"))return!0;i=!0}o.find(".notice-wrap").remove(),o.append('<div class="notice-wrap"></div>');var s=o.find(".notice-wrap"),i=!1;if(null!==t&&0!==t||(s.html('<div class="updated error"><p>'+edd_vars.batch_export_no_class+"</p></div>"),i=!0),"recount-download"===r&&0===n('select[name="download_id"]').val()&&(s.html('<div class="updated error"><p>'+edd_vars.batch_export_no_reqs+"</p></div>"),i=!0),i)return o.find("button:disabled").attr("disabled",!1).removeClass("updated-message"),!1}))}};r(document).ready((function(e){s.init()}))})();