var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/table/Actions/component/ExportImport/utils/download.ts
var download_exports = {};
__export(download_exports, {
  default: () => download_default,
  windowOpen: () => windowOpen
});
module.exports = __toCommonJS(download_exports);
var windowOpen = (url, target) => {
  let oWindow = window.open("", target || "_blank");
  oWindow.location = url;
};
var download_default = (sUrl, fileName) => {
  let isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
  let isSafari = navigator.userAgent.toLowerCase().indexOf("safari") > -1;
  if (/(iP)/g.test(navigator.userAgent)) {
    alert(
      "Your device does not support files downloading. Please try again in desktop browser."
    );
    return false;
  }
  if (isChrome || isSafari) {
    let link = document.createElement("a");
    link.href = sUrl;
    if (link.download !== void 0) {
      let _fileName = fileName || sUrl.substring(sUrl.lastIndexOf("/") + 1, sUrl.length);
      link.download = _fileName;
    }
    if (document.createEvent) {
      let e = document.createEvent("MouseEvents");
      e.initEvent("click", true, true);
      link.dispatchEvent(e);
      return true;
    }
  }
  if (sUrl.indexOf("?") === -1) {
    sUrl += "?download";
  }
  windowOpen(sUrl, "_self");
  return true;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  windowOpen
});
