jQuery(document).ready(function() {
  let d = document.getElementById("edo-ajax-output-btn");
  d && d.addEventListener("click", l);
  let c = document.getElementById("edo-ajax-checkapicred-btn");
  c && c.addEventListener("click", i);
  let s = document.getElementById("edbs_flush_cache_btn");
  s && s.addEventListener("click", r);
  function l() {
    let a = {
      action: "edo_ajax_action"
    };
    jQuery.post(ajax_object.ajax_url, a, function(t) {
      let o = "edo-ajax-output";
      document.getElementById(o), d.classList.add("edbs-green"), location.reload();
    });
  }
  function i() {
    let a = document.getElementById("public_key"), t = document.getElementById("secret_key");
    jQuery.post(ajax_object.ajax_url, {
      action: "validate-api-credentials",
      api1: a.value,
      api2: t.value
    }).done(function(o) {
      let e = document.querySelector("#edo-ajax-checkapicred-btn span"), n = document.getElementById("edo-ajax-checkapicred-btn");
      if (e.classList.remove("dashicons-privacy", "dashicons-yes-alt", "dashicons-dismiss"), n.classList.remove("edbs-wiggle"), !o.data.success) {
        e.classList.add("dashicons-dismiss"), e.style.color = "red", a.style.border = "2px solid red", t.style.border = "2px solid red";
        return;
      }
      e.classList.add("dashicons-yes-alt"), e.style.color = "green", a.style.border = "2px solid green", t.style.border = "2px solid green";
    });
  }
  function r(a) {
    a.preventDefault();
    let t = document.getElementById("edbs_overlay"), o = document.getElementById("edoobox_cache_time_in_s"), e = document.getElementById("caching_meta_box_nonce");
    t.classList.remove("hidden"), setTimeout(function() {
      let n = {
        action: "edo_ajax_flushcache_action",
        edoobox_cache_time_in_s: (o == null ? void 0 : o.value) || 0,
        caching_meta_box_nonce: e == null ? void 0 : e.value
      };
      jQuery.post(ajax_object.ajax_url, n).done(function(u) {
        setTimeout(() => {
          t.classList.remove("hidden"), t.classList.add("hidden");
        }, 200);
      }).fail(function(u, _, m) {
        console.log(m);
      });
    }, 0);
  }
});
//# sourceMappingURL=admin.js.map
