import {
  __commonJS
} from "./chunk-A242L54C.js";

// ../../node_modules/toggle-selection/index.js
var require_toggle_selection = __commonJS({
  "../../node_modules/toggle-selection/index.js"(exports, module) {
    module.exports = function() {
      var selection = document.getSelection();
      if (!selection.rangeCount)
        return function() {
        };
      for (var active = document.activeElement, ranges = [], i = 0; i < selection.rangeCount; i++)
        ranges.push(selection.getRangeAt(i));
      switch (active.tagName.toUpperCase()) {
        // .toUpperCase handles XHTML
        case "INPUT":
        case "TEXTAREA":
          active.blur();
          break;
        default:
          active = null;
          break;
      }
      return selection.removeAllRanges(), function() {
        selection.type === "Caret" && selection.removeAllRanges(), selection.rangeCount || ranges.forEach(function(range) {
          selection.addRange(range);
        }), active && active.focus();
      };
    };
  }
});

// ../../node_modules/copy-to-clipboard/index.js
var require_copy_to_clipboard = __commonJS({
  "../../node_modules/copy-to-clipboard/index.js"(exports, module) {
    "use strict";
    var deselectCurrent = require_toggle_selection(), clipboardToIE11Formatting = {
      "text/plain": "Text",
      "text/html": "Url",
      default: "Text"
    }, defaultMessage = "Copy to clipboard: #{key}, Enter";
    function format(message) {
      var copyKey = (/mac os x/i.test(navigator.userAgent) ? "\u2318" : "Ctrl") + "+C";
      return message.replace(/#{\s*key\s*}/g, copyKey);
    }
    function copy(text, options) {
      var debug, message, reselectPrevious, range, selection, mark, success = !1;
      options || (options = {}), debug = options.debug || !1;
      try {
        reselectPrevious = deselectCurrent(), range = document.createRange(), selection = document.getSelection(), mark = document.createElement("span"), mark.textContent = text, mark.ariaHidden = "true", mark.style.all = "unset", mark.style.position = "fixed", mark.style.top = 0, mark.style.clip = "rect(0, 0, 0, 0)", mark.style.whiteSpace = "pre", mark.style.webkitUserSelect = "text", mark.style.MozUserSelect = "text", mark.style.msUserSelect = "text", mark.style.userSelect = "text", mark.addEventListener("copy", function(e) {
          if (e.stopPropagation(), options.format)
            if (e.preventDefault(), typeof e.clipboardData > "u") {
              debug && console.warn("unable to use e.clipboardData"), debug && console.warn("trying IE specific stuff"), window.clipboardData.clearData();
              var format2 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting.default;
              window.clipboardData.setData(format2, text);
            } else
              e.clipboardData.clearData(), e.clipboardData.setData(options.format, text);
          options.onCopy && (e.preventDefault(), options.onCopy(e.clipboardData));
        }), document.body.appendChild(mark), range.selectNodeContents(mark), selection.addRange(range);
        var successful = document.execCommand("copy");
        if (!successful)
          throw new Error("copy command was unsuccessful");
        success = !0;
      } catch (err) {
        debug && console.error("unable to copy using execCommand: ", err), debug && console.warn("trying IE specific stuff");
        try {
          window.clipboardData.setData(options.format || "text", text), options.onCopy && options.onCopy(window.clipboardData), success = !0;
        } catch (err2) {
          debug && console.error("unable to copy using clipboardData: ", err2), debug && console.error("falling back to prompt"), message = format("message" in options ? options.message : defaultMessage), window.prompt(message, text);
        }
      } finally {
        selection && (typeof selection.removeRange == "function" ? selection.removeRange(range) : selection.removeAllRanges()), mark && document.body.removeChild(mark), reselectPrevious();
      }
      return success;
    }
    module.exports = copy;
  }
});

// ../../node_modules/dequal/dist/index.mjs
var has = Object.prototype.hasOwnProperty;
function find(iter, tar, key) {
  for (key of iter.keys())
    if (dequal(key, tar)) return key;
}
function dequal(foo, bar) {
  var ctor, len, tmp;
  if (foo === bar) return !0;
  if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
    if (ctor === Date) return foo.getTime() === bar.getTime();
    if (ctor === RegExp) return foo.toString() === bar.toString();
    if (ctor === Array) {
      if ((len = foo.length) === bar.length)
        for (; len-- && dequal(foo[len], bar[len]); ) ;
      return len === -1;
    }
    if (ctor === Set) {
      if (foo.size !== bar.size)
        return !1;
      for (len of foo)
        if (tmp = len, tmp && typeof tmp == "object" && (tmp = find(bar, tmp), !tmp) || !bar.has(tmp)) return !1;
      return !0;
    }
    if (ctor === Map) {
      if (foo.size !== bar.size)
        return !1;
      for (len of foo)
        if (tmp = len[0], tmp && typeof tmp == "object" && (tmp = find(bar, tmp), !tmp) || !dequal(len[1], bar.get(tmp)))
          return !1;
      return !0;
    }
    if (ctor === ArrayBuffer)
      foo = new Uint8Array(foo), bar = new Uint8Array(bar);
    else if (ctor === DataView) {
      if ((len = foo.byteLength) === bar.byteLength)
        for (; len-- && foo.getInt8(len) === bar.getInt8(len); ) ;
      return len === -1;
    }
    if (ArrayBuffer.isView(foo)) {
      if ((len = foo.byteLength) === bar.byteLength)
        for (; len-- && foo[len] === bar[len]; ) ;
      return len === -1;
    }
    if (!ctor || typeof foo == "object") {
      len = 0;
      for (ctor in foo)
        if (has.call(foo, ctor) && ++len && !has.call(bar, ctor) || !(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return !1;
      return Object.keys(bar).length === len;
    }
  }
  return foo !== foo && bar !== bar;
}

// ../../node_modules/es-toolkit/dist/array/partition.mjs
function partition(arr, isInTruthy) {
  let truthy = [], falsy = [];
  for (let i = 0; i < arr.length; i++) {
    let item = arr[i];
    isInTruthy(item) ? truthy.push(item) : falsy.push(item);
  }
  return [truthy, falsy];
}

// ../../node_modules/es-toolkit/dist/array/countBy.mjs
function countBy(arr, mapper) {
  let result = {};
  for (let i = 0; i < arr.length; i++) {
    let item = arr[i], key = mapper(item);
    result[key] = (result[key] ?? 0) + 1;
  }
  return result;
}

// ../../node_modules/es-toolkit/dist/array/uniq.mjs
function uniq(arr) {
  return [...new Set(arr)];
}

export {
  dequal,
  countBy,
  partition,
  uniq,
  require_copy_to_clipboard
};
